gitclaw-backup
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitClaw Backup
GitClaw 备份工具
Full backup of to GitHub via git.
/home/node/.openclaw/通过git将目录全量备份到GitHub。
/home/node/.openclaw/Quick Reference
快速参考
- Repo:
https://github.com/blessonism/openclaw-backup.git - Branch:
main - Script:
/home/node/.openclaw/gitclaw/auto_backup.sh - Cron: — 每天 UTC 16:00 (北京时间 0:00)
daily-workspace-backup - Exclude rules:
/home/node/.openclaw/.gitignore
- Repo:
https://github.com/blessonism/openclaw-backup.git - Branch:
main - Script:
/home/node/.openclaw/gitclaw/auto_backup.sh - Cron: — 每天 UTC 16:00 (北京时间 0:00)
daily-workspace-backup - Exclude rules:
/home/node/.openclaw/.gitignore
Manual Sync
手动同步
Run the backup script directly:
bash
bash /home/node/.openclaw/gitclaw/auto_backup.shScript behavior:
- Lock-based (prevents concurrent runs)
- Stages all changes (), respects
git add -A.gitignore - Skips commit if no changes
- Pushes to
origin main - Logs to
/home/node/.openclaw/gitclaw/backup.log
直接运行备份脚本:
bash
bash /home/node/.openclaw/gitclaw/auto_backup.sh脚本行为:
- 基于锁实现(避免并发执行)
- 暂存所有变更(),遵循
git add -A规则.gitignore - 无变更时跳过提交
- 推送到分支
origin main - 日志写入
/home/node/.openclaw/gitclaw/backup.log
Post-Sync Response
同步后响应
After a successful sync, always include a clickable link to the latest commit in your reply:
bash
undefined同步成功后,回复中必须包含指向最新commit的可点击链接:
bash
undefinedGet the latest commit short hash
获取最新commit短哈希
cd /home/node/.openclaw && git log --oneline -1
Then format the response like:
> ✅ 同步完成 — [查看 commit](https://github.com/blessonism/openclaw-backup/commit/<full_hash>)
- If no changes were detected, report "无变更,跳过" (no link needed).
- If the push failed, report the error and suggest troubleshooting steps.cd /home/node/.openclaw && git log --oneline -1
然后按照如下格式返回:
> ✅ 同步完成 — [查看 commit](https://github.com/blessonism/openclaw-backup/commit/<full_hash>)
- 若无变更,返回「无变更,跳过」(无需提供链接)。
- 若推送失败,返回错误信息并给出排查建议。Check Status
状态查询
bash
undefinedbash
undefinedLast backup log
查看最近备份日志
tail -5 /home/node/.openclaw/gitclaw/backup.log
tail -5 /home/node/.openclaw/gitclaw/backup.log
Git status (uncommitted changes)
查看Git状态(未提交变更)
cd /home/node/.openclaw && git status --short
cd /home/node/.openclaw && git status --short
Recent commits
查看最近提交记录
cd /home/node/.openclaw && git log --oneline -5
undefinedcd /home/node/.openclaw && git log --oneline -5
undefinedExclude Files from Backup
配置备份排除文件
Edit — standard gitignore syntax.
/home/node/.openclaw/.gitignoreCurrent notable exclusions: , , , , large binary files.
workspace/images/workspace/node_modules/workspace/.micromamba/workspace/bin/编辑即可,使用标准gitignore语法。
/home/node/.openclaw/.gitignore当前已默认排除的路径:、、、以及大型二进制文件。
workspace/images/workspace/node_modules/workspace/.micromamba/workspace/bin/Troubleshooting
问题排查
- "already running" in log → stale lock at , remove it:
/home/node/.openclaw/gitclaw/lock/rmdir /home/node/.openclaw/gitclaw/lock - Push rejected → likely force-push or diverged history on remote; check with
git log --oneline -5 origin/main - Auth failure → credentials in ; verify with
~/.git-credentialsgit credential fill <<< "host=github.com"
- 日志中出现「already running」→ 存在残留锁文件,执行以下命令删除:
/home/node/.openclaw/gitclaw/lock/rmdir /home/node/.openclaw/gitclaw/lock - 推送被拒绝→大概率是远程分支存在强制推送或历史分叉,可执行排查
git log --oneline -5 origin/main - 认证失败→凭证存储在,可执行
~/.git-credentials验证git credential fill <<< "host=github.com"