mcpField
G
gitclaw-backup

gitclaw-backup

github.com/blessonismCloud & DevOps5555 installsUpdated 32w ago
Repository

About gitclaw-backup

A skill for backing up `/home/node/.openclaw/` to a GitHub repository, intended for people maintaining backups of that workspace. It syncs changes with Git and supports scheduled runs, exclusions, and status checks.

Key features

  1. 01Commit and push workspace changes to GitHub
  2. 02Schedule daily backups at UTC 16:00
  3. 03Prevent concurrent runs with a lock
  4. 04Exclude files using `.gitignore`
  5. 05Log runs and inspect Git status

Use cases

  1. 01Back up the OpenClaw workspace daily
  2. 02Run the script to sync changes manually
  3. 03Review recent backup logs and uncommitted changes
  4. 04Exclude files from backup

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/blessonism/openclaw-skills --skill gitclaw-backup

After installing, type/gitclaw-backupin Claude Code to confirm it loaded.

Details

From the project README

GitClaw Backup

Full backup of /home/node/.openclaw/ to GitHub via git.

Quick Reference

  • Repo: https://github.com/blessonism/openclaw-backup.git
  • Branch: main
  • Script: /home/node/.openclaw/gitclaw/auto_backup.sh
  • Cron: daily-workspace-backup — 每天 UTC 16:00 (北京时间 0:00)
  • Exclude rules: /home/node/.openclaw/.gitignore

Manual Sync

Run the backup script directly:

bash /home/node/.openclaw/gitclaw/auto_backup.sh

Script behavior:

  • Lock-based (prevents concurrent runs)
  • Stages all changes (git add -A), respects .gitignore
  • Skips commit if no changes
  • Pushes to origin main
  • Logs to /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:

# Get the latest commit short hash
cd /home/node/.openclaw && git log --oneline -1

Then format the response like:

✅ 同步完成 — 查看 commit

  • If no changes were detected, report "无变更,跳过" (no link needed).
  • If the push failed, report the error and suggest troubleshooting steps.

Check Status

# Last backup log
tail -5 /home/node/.openclaw/gitclaw/backup.log

# Git status (uncommitted changes)
cd /home/node/.openclaw && git status --short

# Recent commits
cd /home/node/.openclaw && git log --oneline -5

Exclude Files from Backup

Edit /home/node/.openclaw/.gitignore — standard gitignore syntax.

Current notable exclusions: workspace/images/, workspace/node_modules/, workspace/.micromamba/, workspace/bin/, large binary files.

Troubleshooting

  • "already running" in log → stale lock at /home/node/.openclaw/gitclaw/lock/, remove it: 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 ~/.git-credentials; verify with git credential fill <<< "host=github.com"

Comments

Markdown supported