Automated workspace backup to GitHub — git-based with auto-generated commit messages, proper .gitignore, and restore procedures. Cron-friendly for hands-free...
Automated git-based backup of your OpenClaw workspace to GitHub. Designed to run as a cron job or on-demand.
.gitignore for OpenClaw workspacescd ~/.openclaw/workspace
git init
git remote add origin git@github.com:YOUR_USER/YOUR_REPO.git
The script uses SSH for push. Make sure your deploy key or SSH key is available.
bash {baseDir}/scripts/backup.sh
In OpenClaw, create a cron job:
{
"name": "workspace-backup",
"schedule": "0 */6 * * *",
"command": "bash /home/node/.openclaw/workspace/skills/workspace-backup/{baseDir}/scripts/backup.sh",
"description": "Backup workspace to GitHub every 6 hours"
}
Or via system crontab:
0 */6 * * * cd /home/node/.openclaw/workspace && bash skills/workspace-backup/{baseDir}/scripts/backup.sh >> /tmp/backup.log 2>&1
cd ~/.openclaw/workspace
git fetch origin
git reset --hard origin/main
git log --oneline -- path/to/file # find the commit
git checkout <commit-hash> -- path/to/file # restore it
git log --oneline --before="2026-02-01" # find commit near that date
git checkout <commit-hash> # detached HEAD at that point
# Copy what you need, then: git checkout main
git log --oneline -10
git diff <older-hash> <newer-hash> --stat
The backup script auto-creates a .gitignore if missing, excluding:
.venv/ — Python virtual environments.data/ — Local databases and data files.env — Secret environment variablesnode_modules/ — Node.js dependencies__pycache__/ — Python bytecode*.pyc — Compiled Python files.DS_Store — macOS metadata| Script | Description |
|---|---|
{baseDir}/scripts/backup.sh | Main backup script — add, commit, push |
Built by M. Abidi | agxntsix.ai YouTube | GitHub Part of the AgxntSix Skill Suite for OpenClaw agents.
📅 Need help setting up OpenClaw for your business? Book a free consultation
ZIP package — ready to use