OA0
OA0 是一个探索 AI 的社区
现在注册
已注册用户请  登录
OA0  ›  技能包  ›  git-crypt-backup:将 Clawdbot 工作区与配置加密备份至 GitHub

git-crypt-backup:将 Clawdbot 工作区与配置加密备份至 GitHub

 
  desertx ·  2026-02-02 12:48:49 · 20 次点击  · 0 条评论  

名称: git-crypt-backup
描述: 使用 git-crypt 加密,将 Clawdbot 工作区与配置备份至 GitHub。适用于每日自动备份或手动备份/恢复操作。


Git-Crypt 备份

使用 git-crypt 加密敏感文件,将 Clawdbot 工作区 (~/clawd) 和配置 (~/.clawdbot) 自动备份至 GitHub。

设置步骤

1. 创建 GitHub 仓库(建议设为私有)

# 在 GitHub 上创建两个私有仓库:
# - <用户名>/clawdbot-workspace
# - <用户名>/clawdbot-config

2. 初始化 git-crypt

# 安装 git-crypt
brew install git-crypt  # macOS
# apt install git-crypt  # Linux

# 工作区仓库
cd ~/clawd
git init
git-crypt init
git remote add origin git@github.com:<用户名>/clawdbot-workspace.git

# 配置仓库
cd ~/.clawdbot
git init
git-crypt init
git remote add origin git@github.com:<用户名>/clawdbot-config.git

3. 配置加密规则

工作区 .gitattributes

SOUL.md filter=git-crypt diff=git-crypt
USER.md filter=git-crypt diff=git-crypt
HEARTBEAT.md filter=git-crypt diff=git-crypt
MEMORY.md filter=git-crypt diff=git-crypt
memory/** filter=git-crypt diff=git-crypt

配置 .gitattributes

clawdbot.json filter=git-crypt diff=git-crypt
.env filter=git-crypt diff=git-crypt
credentials/** filter=git-crypt diff=git-crypt
telegram/** filter=git-crypt diff=git-crypt
identity/** filter=git-crypt diff=git-crypt
agents/**/sessions/** filter=git-crypt diff=git-crypt
nodes/** filter=git-crypt diff=git-crypt

配置 .gitignore

*.bak
*.bak.*
.DS_Store
logs/
media/
browser/
subagents/
memory/
update-check.json
*.lock

4. 导出密钥(重要!)

mkdir -p ~/clawdbot-keys
cd ~/clawd && git-crypt export-key ~/clawdbot-keys/workspace.key
cd ~/.clawdbot && git-crypt export-key ~/clawdbot-keys/config.key

⚠️ 请妥善保管这些密钥(建议存入 1Password、iCloud 钥匙串、U 盘等安全位置)

5. 首次提交与推送

cd ~/clawd && git add -A && git commit -m "首次备份" && git push -u origin main
cd ~/.clawdbot && git add -A && git commit -m "首次备份" && git push -u origin main

每日备份

运行 scripts/backup.sh

~/clawd/skills/git-crypt-backup/scripts/backup.sh

也可设置 cron 定时任务,实现每日自动备份。

在新机器上恢复

# 1. 克隆仓库
git clone git@github.com:<用户名>/clawdbot-workspace.git ~/clawd
git clone git@github.com:<用户名>/clawdbot-config.git ~/.clawdbot

# 2. 使用密钥解锁
cd ~/clawd && git-crypt unlock /path/to/workspace.key
cd ~/.clawdbot && git-crypt unlock /path/to/config.key

加密与明文文件对照

仓库 加密文件 明文文件
workspace SOUL/USER/HEARTBEAT/MEMORY.md, memory/** AGENTS.md, IDENTITY.md, TOOLS.md, drafts/**
config clawdbot.json, .env, credentials/, sessions/ cron/jobs.json, settings/**
20 次点击  ∙  0 人收藏  
登录后收藏  
0 条回复
关于 ·  帮助 ·  PING ·  隐私 ·  条款   
OA0 - Omni AI 0 一个探索 AI 的社区
沪ICP备2024103595号-2
耗时 57 ms
Developed with Cursor