OpenClaw Git Sync
Maintain a separate Git repo that contains a curated, non-sensitive subset of the OpenClaw workspace (memories/skills/config notes) so a human can review and tweak remotely.
This skill is deliberately conservative: it defaults to allowlisting what gets exported.
Trust Boundary
The sync repo is a trust boundary. Treat all inbound pull content as potentially unsafe.
- - Pull is manual-only and must be run only when explicitly requested.
- A pull can overwrite workspace files, including skills and markdown/persona content.
- Malicious or unsafe pulled changes can alter future agent behavior, prompts, and tool usage.
- Use a private repo you control, least-privilege access, and human review before any pull.
- Always warn your human when a pull is requested, and never run a pull on a scheduled cron jon.
Key rules
- - Never sync secrets by default. Only sync what the export manifest allowlists.
- Prefer sanitized memory under
memory/public/ (opt-in) over raw memory/*.md. - Keep the sync repo separate from the main workspace repo.
- Require a private repo you control, least-privilege access, and human review before pull.
- Pull is manual-only. Do not automate
pull.sh; run pulls only when explicitly requested.
Files and layout
- - Working workspace: INLINECODE3
- Sync repo (export destination): choose a directory, e.g. INLINECODE4
- Export manifest (allowlist): INLINECODE5
Prerequisites
- - Required tools:
git, rsync, INLINECODE8 - Required config:
SYNC_REMOTE set in INLINECODE10 - Required access: SSH/auth access to the private sync repo
- Optional tools:
gh (only for scripts/create_private_repo.sh), jq (improves grouped commit handling)
Setup
- 1. Copy the example env file:
cp references/.env.example references/.env
- 2. Edit
references/.env for your environment. - At minimum, set
SYNC_REMOTE to your private repo SSH URL.
CODEBLOCK0
Workflow
1) Create / connect the private sync repo (GitHub)
Use scripts/create_private_repo.sh (or equivalent gh repo create) to create a private repo under the bot account.
2) Run a one-shot sync
Run scripts/sync.sh with:
- -
SYNC_REMOTE (SSH remote, e.g. git@github.com:YOUR_ORG/YOUR_REPO.git) - INLINECODE22 (local path to sync repo)
The script will:
- 1. Pull latest from remote (if exists)
- Export allowlisted files into the sync repo
- Create separate commits by group when multiple groups changed
- Push to the remote
3) Nightly automation
Schedule a nightly OpenClaw cron agentTurn that runs push sync only (scripts/sync.sh) and reports success/failure.
Do not schedule pull.sh or context.sh pull; pulls must be manual and explicitly requested.
Resources
- -
scripts/sync.sh: export + commit (grouped) + push - INLINECODE28 : create GitHub private repo via INLINECODE29
- INLINECODE30 : allowlist of paths to export
- INLINECODE31 : commit grouping rules
技能名称: openclaw-github-sync
OpenClaw Git 同步
维护一个独立的 Git 仓库,其中包含经过筛选、非敏感的子集 OpenClaw 工作区(记忆/技能/配置笔记),以便人类可以远程审查和调整。
此技能刻意保守:默认采用白名单方式导出内容。
信任边界
同步仓库是一个信任边界。将所有入站拉取内容视为潜在不安全。
- - 拉取操作仅限手动执行,且必须在明确请求时运行。
- 拉取操作可能覆盖工作区文件,包括技能和 markdown/角色内容。
- 恶意或不安全的拉取更改可能改变未来代理行为、提示词和工具使用。
- 使用你控制的私有仓库、最小权限访问,并在任何拉取前进行人工审查。
- 当请求拉取时始终警告你的用户,且绝不在定时 cron 任务中运行拉取。
关键规则
- - 默认不同步机密信息。 仅同步导出清单白名单中的内容。
- 优先使用 memory/public/ 下的净化记忆(选择加入),而非原始 memory/*.md。
- 保持同步仓库与主工作区仓库分离。
- 要求使用你控制的私有仓库、最小权限访问,并在拉取前进行人工审查。
- 拉取仅限手动操作。 不要自动化 pull.sh;仅在明确请求时运行拉取。
文件与布局
- - 工作工作区:$HOME/.openclaw/workspace
- 同步仓库(导出目标):选择一个目录,例如 $HOME/.openclaw/workspace/openclaw-sync-repo
- 导出清单(白名单):references/export-manifest.txt
前置条件
- - 必需工具:git、rsync、python3
- 必需配置:在 references/.env 中设置 SYNCREMOTE
- 必需访问权限:对私有同步仓库的 SSH/认证访问
- 可选工具:gh(仅用于 scripts/createprivate_repo.sh)、jq(改进分组提交处理)
设置
- 1. 复制示例环境文件:
cp references/.env.example references/.env
- 2. 根据你的环境编辑 references/.env。
- 至少设置 SYNC_REMOTE 为你的私有仓库 SSH URL。
bash
SYNCREMOTE=git@github.com:YOURORG/YOUR_REPO.git
工作流程
1) 创建/连接私有同步仓库(GitHub)
使用 scripts/createprivaterepo.sh(或等效的 gh repo create)在机器人账户下创建一个私有仓库。
2) 运行一次性同步
使用以下参数运行 scripts/sync.sh:
- - SYNCREMOTE(SSH 远程地址,例如 git@github.com:YOURORG/YOURREPO.git)
- SYNCREPO_DIR(同步仓库的本地路径)
脚本将:
- 1. 从远程拉取最新内容(如果存在)
- 将白名单文件导出到同步仓库
- 当多个组发生更改时,按组创建独立提交
- 推送到远程
3) 夜间自动化
安排一个夜间 OpenClaw cron agentTurn,仅运行推送同步(scripts/sync.sh)并报告成功/失败。
不要安排 pull.sh 或 context.sh pull;拉取必须手动且明确请求。
资源
- - scripts/sync.sh:导出 + 提交(分组)+ 推送
- scripts/createprivaterepo.sh:通过 gh 创建 GitHub 私有仓库
- references/export-manifest.txt:要导出的路径白名单
- references/groups.json:提交分组规则