Automatically backs up OpenClaw configuration and workspace metadata to a git repository.
openclaw.json- Main OpenClaw configurationdevices/paired.json- Device pairing information (no secrets)
.cursorrulesfiles - Your AI guardrails for each project- Project metadata (but not the actual code - that should be in separate repos)
- API keys (
auth-profiles.json) - NEVER committed - SSH keys and certificates
- Log files
- Session history
- Actual workspace code (use git per-project)
# On GitHub, create a private repo called "openclaw-config-backup"
# Then get the SSH URLEdit ansible/inventory/group_vars/all.yml:
openclaw_backup_repo: "git@github.com:yourusername/openclaw-config-backup.git"
# Optional: customize schedule (default: daily at 2 AM)
openclaw_backup_cron_minute: "0"
openclaw_backup_cron_hour: "2"cd ansible
ansible-playbook -i inventory/hosts playbooks/site.ymlssh ubuntu@your-proxmox-vm
~/openclaw-backups/backup.shThis script sets up git repositories for all your OpenClaw workspace projects:
ssh ubuntu@your-proxmox-vm
~/bin/init-workspace-repos.shThis will:
- ✓ Initialize git in each workspace project
- ✓ Create .gitignore files
- ✓ Create README.md templates
- ✓ Make initial commits
- ✓ Include .cursorrules files in each repo
Then push each project to its own GitHub repo:
cd ~/.openclaw/workspace/my-project
git remote add origin git@github.com:yourusername/my-project.git
git push -u origin mainssh ubuntu@your-proxmox-vm
tail -f ~/openclaw-backups/backup.logssh ubuntu@your-proxmox-vm
crontab -l | grep openclaw-
Config Backups (this role)
- OpenClaw settings (daily automated)
- Device pairing info
- Workspace .cursorrules files
-
Workspace Projects (per-project git)
- Each project is its own repo
- Code + .cursorrules together
- Standard git workflow
-
VM Snapshots (Proxmox)
- Weekly full VM snapshots
- Disaster recovery
- Before major upgrades
# After creating a new workspace project in OpenClaw:
ssh ubuntu@your-vm
cd ~/.openclaw/workspace/new-project
# Initialize git
git init
git add .
git commit -m "Initial commit"
# Create GitHub repo and push
git remote add origin git@github.com:yourusername/new-project.git
git push -u origin main
# Clone locally on your Mac
git clone git@github.com:yourusername/new-project.gitNow you can:
- Edit locally or via OpenClaw
- Commit and push changes
- Your .cursorrules travel with the code
- Config is backed up separately
Problem: SSH keys not set up for git in VM
Solution:
# Generate SSH key on VM
ssh ubuntu@your-vm
ssh-keygen -t ed25519 -C "openclaw@your-vm"
# Add to GitHub
cat ~/.ssh/id_ed25519.pub
# Copy and add to GitHub > Settings > SSH Keys
# Test connection
ssh -T git@github.comProblem: Workspace directory empty or OpenClaw not fully deployed
Solution: Create a project via OpenClaw first, then run the script.
Check cron logs:
grep CRON /var/log/syslog | tail -20Verify cron is installed:
sudo systemctl status cronSee defaults/main.yml for all configurable variables:
openclaw_backup_dir- Where backups are stored (default:~/openclaw-backups)openclaw_backup_repo- Git repo URL (leave empty to disable)openclaw_backup_cron_*- Cron schedule settings