Install
openclaw skills install openclaw-git-backupCreate, update, validate, or troubleshoot automated git backup workflows for OpenClaw repositories. Use when a user wants a scheduled commit-and-push backup job, wants commit messages to summarize added or modified or deleted files, needs git credential setup for HTTPS pushes, or needs to debug why an OpenClaw cron backup is not running or not pushing.
openclaw skills install openclaw-git-backupUse this skill to build a reusable nightly git backup workflow for an OpenClaw repo.
What this workflow does:
+added ~modified -deleted countsgit push even if there was no new commit, so older unpushed commits are flushedBefore changing anything, confirm these values:
<repo-root><runtime-script><timezone>originIf the user already implied these values, proceed without turning it into an interview.
Reasonable defaults for a fresh setup:
originUTCOpenClaw Backupbackup@localmain when detachedThis skill includes scripts/nightly_git_backup.sh.
Prefer using the bundled script as the implementation source, then copy it into the runtime location the user wants the cron job to call.
Typical install step:
install -D -m 755 <skill-dir>/scripts/nightly_git_backup.sh <runtime-script>
bash -n <runtime-script>
The bundled script supports these env vars:
BACKUP_REMOTE — default originBACKUP_BRANCH — optional explicit target branchBACKUP_TZ — default UTCBACKUP_AUTHOR_NAME — default OpenClaw BackupBACKUP_AUTHOR_EMAIL — default backup@localBACKUP_EXCLUDES — comma-separated git pathspec exclude patterns, e.g. cron,cron/**,.cache,.cache/**The first positional argument is the repo path. If omitted, the script uses BACKUP_REPO or the current directory.
Check:
git -C <repo-root> rev-parse --show-toplevelgit -C <repo-root> status --short --branchgit -C <repo-root> remote -vopenclaw cron list or equivalent cron listingCopy the bundled script into the runtime path the cron job will execute.
If HTTPS push is already working, leave auth alone.
If the user explicitly provides a GitHub HTTPS token, prefer repo-local credential storage instead of embedding credentials in the remote URL:
git -C <repo-root> config credential.helper 'store --file=<repo-root>/.git/credentials'
git -C <repo-root> config credential.useHttpPath true
printf 'protocol=https\nhost=github.com\npath=OWNER/REPO.git\nusername=x-access-token\npassword=TOKEN\n' | git -C <repo-root> credential approve
chmod 600 <repo-root>/.git/credentials
git -C <repo-root> ls-remote --heads <remote> <branch>
Rules:
600Read references/cron-job-template.md.
Set the job so it executes:
bash -lc '<runtime-script> <repo-root>'
Typical cron settings:
Do not stop at “job created”. Always test the full path.
After force-run, check:
git status --short --branchgit rev-list --left-right --count <remote>/<branch>...HEAD if push is expectedbash -n <runtime-script>git -C <repo-root> status --short --branchgit -C <repo-root> remote -vgit -C <repo-root> ls-remote --heads <remote> <branch>The bundled script writes:
backup: snapshot YYYY-MM-DD HH:MM:SS +0000 | +A ~M -D
Added(n)
- ...
Modified(n)
- ...
Deleted(n)
- ...
Renamed(n)
- old -> new
Keep the body factual and file-oriented.
Some repos contain scheduler state that changes every run. Exclude it explicitly with BACKUP_EXCLUDES.
Example:
BACKUP_EXCLUDES='cron,cron/**'
Git only backs up files inside the target repo. If a workflow also depends on directories outside the repo, they are not covered unless the user explicitly adds a second sync or mirrors them into the repo.
See references/backup-scope.md.
“Cron job exists” is not enough.
The real success condition is:
When reporting back, keep it concrete: