Git-Crypt Backup技能使用说明
2026-03-29
新闻来源:网淘吧
围观:6
电脑广告
手机广告
Git-Crypt 备份
自动备份 Clawdbot 工作区 (~/clawd) 和配置 (~/.clawdbot) 到 GitHub,并使用 git-crypt 加密敏感文件。
设置步骤
1. 创建 GitHub 仓库(建议设为私有)
# Create two private repos on GitHub:
# - <username>/clawdbot-workspace
# - <username>/clawdbot-config
2. 初始化 git-crypt
# Install git-crypt
brew install git-crypt # macOS
# apt install git-crypt # Linux
# Workspace repo
cd ~/clawd
git init
git-crypt init
git remote add origin git@github.com:<username>/clawdbot-workspace.git
# Config repo
cd ~/.clawdbot
git init
git-crypt init
git remote add origin git@github.com:<username>/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 "Initial backup" && git push -u origin main
cd ~/.clawdbot && git add -A && git commit -m "Initial backup" && git push -u origin main
每日备份
运行scripts/backup.sh:
~/clawd/skills/git-crypt-backup/scripts/backup.sh
或者设置一个cron任务以实现自动每日备份。
在新机器上恢复
# 1. Clone repos
git clone git@github.com:<username>/clawdbot-workspace.git ~/clawd
git clone git@github.com:<username>/clawdbot-config.git ~/.clawdbot
# 2. Unlock with keys
cd ~/clawd && git-crypt unlock /path/to/workspace.key
cd ~/.clawdbot && git-crypt unlock /path/to/config.key
加密内容
| 仓库 | 已加密 | 明文 |
|---|---|---|
| 工作空间 | SOUL/USER/HEARTBEAT/MEMORY.md, memory/** | AGENTS.md, IDENTITY.md, TOOLS.md, drafts/** |
| 配置 | clawdbot.json, .env, credentials/, sessions/ | cron/jobs.json, settings/** |
文章底部电脑广告
手机广告位-内容正文底部


微信扫一扫,打赏作者吧~