Files
skills/scripts/README-git-auto-commit.md
T

63 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Git 自动提交脚本使用说明
## 文件说明
- `git-auto-commit.sh` - 自动提交脚本
- `git-config.env` - 认证配置文件(需要你自己填写)
## 配置步骤
1. **编辑配置文件**
```bash
# 编辑 scripts/git-config.env
GIT_USERNAME="你的用户名"
GIT_PASSWORD="你的密码或Access Token"
```
2. **测试脚本**
```bash
# 给脚本执行权限
chmod +x scripts/git-auto-commit.sh
# 测试提交当前目录
./scripts/git-auto-commit.sh C:\Users\yimutao\.openclaw\workspace
```
3. **设置定时任务(每晚12点)**
**Windows (使用任务计划程序):**
```powershell
# 创建任务(以管理员身份运行 PowerShell
$Action = New-ScheduledTaskAction -Execute "wsl.exe" -Argument "bash /mnt/c/Users/yimutao/.openclaw/workspace/scripts/git-auto-commit.sh /mnt/c/Users/yimutao/.openclaw/workspace"
$Trigger = New-ScheduledTaskTrigger -Daily -At "00:00"
Register-ScheduledTask -TaskName "GitAutoCommit" -Action $Action -Trigger $Trigger
```
**或者使用 Git Bash:**
```bash
# 编辑 crontab
crontab -e
# 添加以下行(每晚12点执行)
0 0 * * * /c/Users/yimutao/.openclaw/workspace/scripts/git-auto-commit.sh /c/Users/yimutao/.openclaw/workspace
```
**Linux/Mac:**
```bash
crontab -e
# 添加:
0 0 * * * /path/to/git-auto-commit.sh /path/to/source
```
## 安全提示
- `git-config.env` 文件包含敏感信息,已添加到 `.gitignore`
- 建议使用 Gitea Access Token 而不是密码
- 在 Gitea 中生成 Token: 用户设置 -> 应用 -> 生成令牌
## 手动运行
```bash
./scripts/git-auto-commit.sh <要提交的目录>
```