/install git-backup-publish
Git Backup
Backup OpenClaw agent workspace to Git repository for data safety and migration capability.
Author: 徐琛 ([email protected])
License: Apache 2.0
⚠️ 使用前必读
使用此技能前,你需要准备:
| 信息 | 如何获取 |
|---|---|
| Git 平台 Token | Gitee: https://gitee.com/profile/personal_access_tokens\x3Cbr>GitHub: https://github.com/settings/tokens\x3Cbr>GitLab: https://gitlab.com/-/profile/personal_access_tokens |
| Git 用户名 | 你的 Git 平台用户名 |
| Agent 名称 | 你的 agent 标识符(用于仓库命名) |
Token 权限要求:
projects/repo- 创建和管理仓库user_info/read:user- 读取用户信息
Quick Start
1. 创建仓库
# Gitee
curl -X POST "https://gitee.com/api/v5/user/repos" \
-H "Content-Type: application/json" \
-d '{
"access_token": "YOUR_TOKEN",
"name": "openclaw-agent-YOUR_AGENT_NAME",
"description": "OpenClaw Agent Backup",
"private": true,
"auto_init": true
}'
# GitHub (使用 gh cli)
gh repo create openclaw-agent-YOUR_AGENT_NAME --private --description "OpenClaw Agent Backup"
2. 执行备份
export GITEE_TOKEN="your_token_here"
export GITEE_REPO="https://gitee.com/YOUR_USERNAME/openclaw-agent-YOUR_AGENT_NAME.git"
export AGENT_NAME="your_agent_name"
./scripts/backup-to-gitee.sh "Backup message"
3. 配置自动备份(可选)
在你的 HEARTBEAT.md 中添加:
### 文件变更检测与备份
- 检查核心文件变更时自动备份
- 脚本: /path/to/git-backup/scripts/watch-and-backup.sh
备份内容
| 类型 | 文件 |
|---|---|
| 核心文档 | AGENTS.md, SOUL.md, IDENTITY.md, USER.md, MEMORY.md, TOOLS.md, HEARTBEAT.md |
| 记忆 | memory/ 目录 |
| 技能 | skills/ 目录 |
不备份: 数据库、任务脚本、临时文件、.env、密钥等
脚本说明
| 脚本 | 用途 |
|---|---|
setup-gitee.sh |
初始化配置(创建仓库、保存配置) |
backup-to-gitee.sh |
执行备份 |
create-repo.sh |
快速创建仓库工具 |
watch-and-backup.sh |
文件变更监控(用于心跳检测) |
环境变量
| 变量 | 必需 | 说明 |
|---|---|---|
GITEE_TOKEN |
是 | Git 平台的 Personal Access Token |
GITEE_REPO |
是 | 仓库 URL |
AGENT_NAME |
是 | Agent 标识符 |
WORKSPACE_DIR |
否 | 工作区路径,默认 ~/.openclaw/workspace |
安全提示
- 不要将 Token 提交到公开仓库
- 使用环境变量或配置文件存储敏感信息
- 定期轮换 Token
- 使用私有仓库备份敏感数据
支持的平台
- ✅ Gitee(默认)
- ✅ GitHub(修改 API 端点即可)
- ✅ GitLab(修改 API 端点即可)
- ✅ 自建 Git 服务器
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install git-backup-publish - After installation, invoke the skill by name or use
/git-backup-publish - Provide required inputs per the skill's parameter spec and get structured output
What is git-backup?
Backup OpenClaw workspace files (docs, memory, skills) to a private Git repo (Gitee/GitHub/GitLab) for data safety and migration. It is an AI Agent Skill for Claude Code / OpenClaw, with 385 downloads so far.
How do I install git-backup?
Run "/install git-backup-publish" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is git-backup free?
Yes, git-backup is completely free (open-source). You can download, install and use it at no cost.
Which platforms does git-backup support?
git-backup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created git-backup?
It is built and maintained by solidexu (@solidexu); the current version is v1.0.0.