← 返回
开发者工具 中文

Workspace Git Backup

Set up automatic scheduled backups to GitHub or GitLab. Use when users want to backup their OpenClaw workspace or other directories. Supports GitHub CLI for...
设置自动定时备份到 GitHub 或 GitLab。适用于用户需要备份 OpenClaw 工作区或其他目录的场景。支持 GitHub CLI 进行...
cooperun
开发者工具 clawhub v1.0.0 1 版本 99829.1 Key: 无需
★ 1
Stars
📥 564
下载
💾 5
安装
1
版本
#latest

概述

GitHub Backup

Automatic scheduled backup of any directory to a remote Git repository.

Setup Flow

When user asks for backup setup, follow these steps:

1. Ask for backup directory

Default: ~/.openclaw/workspace

2. Configure remote repository

If GitHub CLI (gh) is available and authenticated:

Ask user:

  • "新建 GitHub 仓库 还是 同步到已有仓库?"

New repo:

gh repo create <name> --private --source=<backup-path> --remote=origin

Existing repo:

# List repos
gh repo list --limit 50

# Add remote (user provides repo name or URL)
git -C <backup-path> remote add origin <url>

If no GitHub CLI:

  • Ask user for repository URL directly

3. Create config file

cat > ~/.openclaw/workspace/.backup-config.json << 'EOF'
{
  "backupPath": "<backup-path>",
  "gitRemote": "<repo-url>",
  "schedule": "0 12,0 * * *",
  "updateTimestamp": true
}
EOF

4. Install backup script

mkdir -p ~/.openclaw/scripts
cp <skill-path>/scripts/backup.sh ~/.openclaw/scripts/github-backup.sh
chmod +x ~/.openclaw/scripts/github-backup.sh

5. Install scheduled task

macOS (launchd):

bash <skill-path>/scripts/install-launchd.sh

Linux (cron):

bash <skill-path>/scripts/install-cron.sh

6. Optional: First backup

bash ~/.openclaw/scripts/github-backup.sh

Commands

After setup, user can:

CommandAction
-----------------
bash ~/.openclaw/scripts/github-backup.shManual backup
bash /scripts/manage.sh statusCheck status
bash /scripts/manage.sh logsView logs
bash /scripts/manage.sh uninstallRemove scheduled task

Configuration

Config: ~/.openclaw/workspace/.backup-config.json

FieldDefaultDescription
-----------------------------
backupPath~/.openclaw/workspaceDirectory to backup
gitRemoterequiredRepository URL
schedule0 12,0 *Cron: 12:00 & 00:00 daily
updateTimestamptrueUpdate README timestamp

Backup Script Logic

Check for git changes
  └── No changes → exit
  └── Has changes → continue
       ↓
Update README timestamp (optional)
       ↓
git add . && git commit -m "chore: 自动备份"
       ↓
git push

Files Created

FileLocation
----------------
Backup script~/.openclaw/scripts/github-backup.sh
Config~/.openclaw/workspace/.backup-config.json
Log~/.openclaw/logs/github-backup.log
launchd plist~/Library/LaunchAgents/com.openclaw.github-backup.plist
cron entryVia crontab

Example Dialog

User: 帮我配置 workspace 自动备份

Agent:
1. 检测 gh CLI → 已登录
2. "新建仓库还是用已有的?" → "新建"
3. "仓库名称?" → "openclaw-backup"
4. "公开还是私有?" → "私有"
5. 执行: gh repo create openclaw-backup --private --source=~/.openclaw/workspace --remote=origin
6. 创建配置文件
7. 安装定时任务
8. "安装完成,每天 12:00 和 00:00 自动备份"

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-30 16:36 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

OpenClaw Diagnostics

cooperun
诊断并排除 OpenClaw 配置、频道、群消息、定时任务及认证问题,使用日志和内置知识库。
★ 1 📥 804
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,372
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,834