← 返回 Skills 市场
fangbb-coder

Backup 2 Github

作者 fangbb-coder · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
204
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install backup-2-github
功能描述
Backup personalized OpenClaw configuration and user data to a GitHub repo with single-commit history and optional dry-run preview.
使用说明 (SKILL.md)

Backup to GitHub

OpenClaw skill to backup personalized configuration and user data to a GitHub repository. Ensures easy migration and disaster recovery.

Features

  • ✅ Backup only personalized files (not default OpenClaw)
  • ✅ Restore to fresh installation with identical state
  • ✅ Supports GitHub via Personal Access Token
  • ✅ Single-commit backup (clean history)
  • ✅ Dry-run mode to preview changes

What Gets Backed Up

This skill backs up files that are specific to your setup, excluding default OpenClaw installation files:

  • Core Configuration: openclaw.json (TTS, skills, plugins settings)
  • Long-term Memory: MEMORY.md (curated memories, learned context)
  • User Identity: USER.md, IDENTITY.md, SOUL.md (your profile & persona)
  • Custom Tools: TOOLS.md (camera names, SSH hosts, voice preferences, etc.)
  • Heartbeat Tasks: HEARTBEAT.md (periodic checklists)
  • Scheduled Jobs: cron/jobs.json (your cron task configuration)
  • Monitoring Panel: Custom monitor scripts (openclaw-monitor.cjs, monitor/*.cjs)
  • Skill Configurations: Selected skill config files (YAML, README, SKILL.md) for skills you've customized (edit backup.py to add paths)
  • Custom Scripts: Any user-created scripts (edit backup.py to add paths)
  • Credentials (optional): credentials/*.json (Xiaohongshu cookies, etc.) - configurable

Automatically Excluded:

  • Default/standard skills from the library
  • Daily memory files (memory/YYYY-MM-DD.md) - too large/ephemeral
  • Cron run logs (cron/runs/)
  • Temporary files, caches, .git, __pycache__, venv, node_modules
  • Large model files and binaries

Prerequisites

  • GitHub account with Personal Access Token (repo scope)
  • Backup repository (private recommended)

Setup

# Install dependencies
pip install -r requirements.txt

# Configure (create .env file)
GITHUB_TOKEN=ghp_your_token_here
GITHUB_REPO=your-username/your-backup-repo

Usage

# Backup current configuration
python backup.py --action backup

# Preview what will be backed up (no push)
python backup.py --action backup --dry-run

# Restore from backup (overwrites existing files)
python backup.py --action restore

How It Works

Backup

  1. Scans predefined file list (in backup.pyBACKUP_FILES)
  2. Filters out excluded patterns
  3. Creates a single commit on the default branch with all file changes
  4. Pushes to your GitHub repository

Restore

  1. Fetches the latest backup commit
  2. Downloads each file to its original location
  3. Reports success and suggests service restarts

Customization

Edit BACKUP_FILES in backup.py to add or remove files from backup.

Security Notes

  • GitHub Token should have minimal scope (repo only)
  • Store token in .env (never commit)
  • Use a private repository for backups
  • Credentials (e.g., Xiaohongshu cookies) are optional and clearly marked

Limitations

  • Does not backup large binary files (ML models, caches, datasets)
  • Does not backup running state (processes, logs)
  • Daily memory files excluded by design (too large, ephemeral)
  • Requires internet access for GitHub operations

Troubleshooting

Error: GITHUB_TOKEN not set → Set token in .env or use --token flag.

Error: Repository not found → Check GITHUB_REPO format: owner/repo.

File not backing up → Ensure path is in BACKUP_FILES and not excluded by patterns.

License

MIT

安全使用建议
Before installing or running this skill: 1) Treat the GitHub Personal Access Token (GITHUB_TOKEN) as sensitive — give it the minimal scope (repo) and store it securely (do not commit it). 2) Inspect BACKUP_FILES and EXCLUDE_PATTERNS inside backup.py to ensure no secrets or unexpected paths (e.g., credentials/*.json, SSH keys, or other sensitive files) are included. 3) Use --dry-run first to verify what will be sent, and prefer a private repository for backups. 4) Note the hardcoded WORKSPACE/HOME paths (/root/.openclaw): adjust them if your OpenClaw runs as a non-root user or to avoid exposing other root-owned files. 5) Be aware restore overwrites files — confirm backups and test restores in a safe/sandboxed environment before relying on this in production. 6) Consider asking the publisher to correct the registry metadata to declare required env vars (GITHUB_TOKEN, GITHUB_REPO) so the manifest accurately reflects the credential needs.
功能分析
Type: OpenClaw Skill Name: backup-2-github Version: 1.0.1 The skill is designed to back up highly sensitive configuration and identity files (including 'openclaw.json', 'USER.md', and 'MEMORY.md') to a GitHub repository. While documented as a backup utility, it handles credentials and personal data that could lead to significant data exfiltration if the user misconfigures the repository visibility or if the GitHub token is over-privileged. A hardcoded default repository ('fangbb-coder/OC-backup') is present in 'backup.py', which is risky if a user executes the script without overriding the destination.
能力评估
Purpose & Capability
The skill's name/description (backup to GitHub) aligns with the code and SKILL.md: it scans OpenClaw config/memory/profile files and pushes a single-commit backup to a GitHub repo. However, the registry metadata declares no required environment variables or primary credential even though both the SKILL.md and backup.py require a GITHUB_TOKEN and usually a GITHUB_REPO setting. That manifest omission is an incoherence and a transparency issue.
Instruction Scope
SKILL.md and backup.py limit actions to reading configured OpenClaw workspace/home paths and pushing to a GitHub repo. This stays within the stated backup scope. Important caveat: the script can include optional sensitive files (credentials/*.json) and any paths added to BACKUP_FILES, and the restore action will overwrite local files. Those behaviors are consistent with a backup/restore tool but are sensitive operations that require user review and explicit configuration.
Install Mechanism
Installation is standard Python dependency installation (pip install -r requirements.txt) for PyGithub and python-dotenv. No obscure downloads, URL extracts, or external binary fetches are used in the provided files.
Credentials
The skill requires a GitHub Personal Access Token (GITHUB_TOKEN) and a repository name (GITHUB_REPO) to function, and the code reads these via dotenv/env. The registry metadata, however, lists no required env vars or primary credential — a meaningful mismatch. The script can back up credentials if enabled, so requesting a GitHub token is expected but must be declared and justified explicitly in metadata.
Persistence & Privilege
The skill does not request always: true and does not modify other skills or system-wide configs. It performs normal backup/restore filesystem writes under the specified OpenClaw workspace/home paths; restore requires interactive confirmation ('yes').
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install backup-2-github
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /backup-2-github 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Remove personal references, make generic
v1.0.0
Initial release
元数据
Slug backup-2-github
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

Backup 2 Github 是什么?

Backup personalized OpenClaw configuration and user data to a GitHub repo with single-commit history and optional dry-run preview. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 204 次。

如何安装 Backup 2 Github?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install backup-2-github」即可一键安装,无需额外配置。

Backup 2 Github 是免费的吗?

是的,Backup 2 Github 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Backup 2 Github 支持哪些平台?

Backup 2 Github 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Backup 2 Github?

由 fangbb-coder(@fangbb-coder)开发并维护,当前版本 v1.0.1。

💬 留言讨论