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

1.6 KiB
Raw Blame History

Git 自动提交脚本使用说明 (Python 版本)

文件说明

  • git_auto_commit.py - Python 自动提交脚本
  • git_config.env - 需要你填写的认证配置

配置步骤

  1. 编辑配置文件

    # 编辑 scripts/git_config.env
    GIT_USERNAME=你的用户名
    GIT_TOKEN=你的Access Token
    
  2. 测试脚本

    # 直接运行(使用默认目录 C:/ai/openclaw
    python scripts/git_auto_commit.py
    
    # 或指定其他目录
    python scripts/git_auto_commit.py D:/其他/目录
    
  3. 设置定时任务(每晚12点)

    Windows (PowerShell 管理员):

    $Action = New-ScheduledTaskAction -Execute "python.exe" -Argument "C:\ai\openclaw\scripts\git_auto_commit.py"
    $Trigger = New-ScheduledTaskTrigger -Daily -At "00:00"
    Register-ScheduledTask -TaskName "GitAutoCommit" -Action $Action -Trigger $Trigger
    

    或者使用任务计划程序 GUI:

    1. 打开"任务计划程序"
    2. 创建基本任务
    3. 触发器: 每天 00:00
    4. 操作: 启动程序
    5. 程序: pythonpython.exe
    6. 参数: C:\ai\openclaw\scripts\git_auto_commit.py

安全提示

  • git_config.env 文件包含敏感信息,已添加到 .gitignore
  • 强烈建议使用 Gitea Access Token 而不是密码
  • 在 Gitea 中生成 Token: 用户设置 -> 应用 -> 生成令牌

手动运行

# 使用默认目录 (C:/ai/openclaw)
python scripts/git_auto_commit.py

# 指定目录
python scripts/git_auto_commit.py C:/其他/路径

依赖

只需要 Python 3.6+,无需额外依赖。