← 返回 Skills 市场
ziqi-jin

alfred-github-backup

作者 ziqi · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
260
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install alfred-github-backup
功能描述
GitHub 仓库备份技能 - 将 OpenClaw 工作空间备份到 GitHub 私有仓库。 支持两种模式:(1) 自动模式 - 定时自动备份 (2) 手动模式 - 交互式配置向导。 自动引导用户完成:GitHub Token 配置 → 仓库创建 → 初始化备份 → 设置定时任务。 用途:(1) 首次设置 (2...
使用说明 (SKILL.md)

GitHub 仓库备份

自动将工作空间备份到 GitHub 私有仓库的完整解决方案。

触发方式

触发词 模式 说明
"设置 GitHub 备份" 手动 运行交互式配置向导
"自动备份到 GitHub" 自动 设置定时任务
"立即备份" 手动 立即执行一次备份
"查看备份状态" 手动 检查备份状态

手动模式:交互式配置向导

当用户说"设置 GitHub 备份"时,进入交互式问答:

问题 1:GitHub 用户名

请告诉我你的 GitHub 用户名是什么?

等待用户回答(如:ziqi-jin)

问题 2:仓库名

你想用什么名字创建备份仓库? 建议:jeremy-agents-backupopenclaw-backup

等待用户回答

问题 3:GitHub Token

现在需要生成 GitHub Token:

  1. 访问 https://github.com/settings/tokens
  2. 点击 "Generate new token (classic)"
  3. Note 填写:backup-token
  4. 勾选 repo 权限
  5. 点击生成,然后复制 Token 给我

等待用户粘贴 Token(验证 Token 格式:ghp_ 开头)

问题 4:备份时间

选择每天自动备份的时间:

  • A) 凌晨 3:00
  • B) 早上 7:00
  • C) 中午 12:00
  • D) 下午 6:00

或者输入你希望的具体时间(如:每天下午 5 点)

等待用户选择或输入

问题 5:确认

配置确认:

  • GitHub 用户名:[用户名]
  • 仓库名:[仓库名]
  • 备份时间:[时间]

确认请回复"确认"或"yes",修改请回复具体要改的部分

用户确认后,执行初始化并设置定时任务。


自动模式:定时备份

当用户选择自动模式或确认配置后:

1. 执行首次备份

git add AGENTS.md SOUL.md USER.md IDENTITY.md TOOLS.md HEARTBEAT.md skills/ memory/
git commit -m "Initial backup: $(date +%Y-%m-%d)"
git push origin main

2. 设置 OpenClaw Cron

openclaw cron add --name "github-backup" --cron "0 \x3Chour> * * *" --message "执行 GitHub 备份" --agent main

手动触发:立即备份

当用户说"立即备份"或"现在备份"时:

cd /root/.openclaw/workspace
git add AGENTS.md SOUL.md USER.md IDENTITY.md TOOLS.md HEARTBEAT.md skills/ memory/
git commit -m "Manual backup: $(date +%Y-%m-%d_%H:%M)"
git push origin main

完成后告诉用户备份结果。


查看备份状态

当用户说"备份状态"或"上次备份什么时候"时:

cd /root/.openclaw/workspace
git log -1 --format="最后备份: %cd"
git status
git remote -v

显示:

  • 最后备份时间
  • 当前状态(有/无未提交更改)
  • 远程仓库配置

故障排除

常见问题

问题 原因 解决
Token 无效 token 过期或权限不足 重新生成有 repo 权限的 token
仓库不存在 仓库名拼写错误 检查仓库名是否正确
Push 失败 没有权限或网络问题 检查 token 权限和网络
定时不执行 cron 配置错误 openclaw cron list 检查

手动修复命令

# 检查远程仓库
git remote -v

# 重新设置远程
git remote set-url origin https://x-access-token:[email protected]/user/repo.git

# 查看 cron 任务
openclaw cron list

# 手动运行备份
bash ~/.openclaw/workspace/skills/github-backup/scripts/backup.sh

备份内容

会备份

  • skills/ - 所有已安装的技能
  • memory/ - 记忆文件
  • AGENTS.md - Agent 配置
  • SOUL.md - AI 身份
  • USER.md - 用户信息
  • IDENTITY.md - 身份信息
  • TOOLS.md - 工具配置
  • HEARTBEAT.md - 心跳任务
  • README.md, SYNC.md - 文档

不会备份

  • .clawhub/ - 缓存
  • .openclaw/ - 运行时
  • node_modules/ - 依赖
  • *.log - 日志
  • *.tmp - 临时文件
  • API Keys - 敏感信息

恢复指南

用户需要恢复时说"从 GitHub 恢复":

# 1. 克隆仓库
git clone https://github.com/[user]/[repo].git /tmp/restore

# 2. 恢复文件
cp -r /tmp/restore/* ~/.openclaw/workspace/

# 3. 重新配置环境变量
# (因为敏感信息不在备份中)

交互提示词

触发本技能的关键词:

  • "设置 GitHub 备份"
  • "备份到 GitHub"
  • "自动备份"
  • "手动备份"
  • "立即备份"
  • "备份状态"
  • "查看备份"
  • "github backup"
  • "配置定时备份"
安全使用建议
Before installing or running this skill, consider the following: - Token handling: the workflow requires a personal access token (repo scope). Do not paste long-lived tokens into UI/chat unless you trust the agent. The provided script embeds the token in the Git remote URL, which will store it in .git/config in plaintext. Prefer alternatives: use a short-lived token, a deployment key, GitHub Actions with secrets, or a credential helper rather than embedding the token in the remote URL. - Repository creation mismatch: the skill description says it will create the repository but the script does not. Either manually create the private repo first, or inspect/extend the skill to use the GitHub API or gh CLI to create repos safely. - Sensitive data in backups: the script includes skills/ and memory/ in backups. Inspect the memory/ and skills/ contents for secrets, API keys, or credentials before backing them up. The SKILL.md claims 'API Keys not backed up', but that depends entirely on what files actually contain; do not assume secrets are excluded automatically. - Storage location and permissions: the script expects /root/.openclaw/workspace (and SKILL.md sometimes uses ~/.openclaw). Run the script as a non-root user where possible, confirm paths, and check file ownership and permissions so backups are not readable by unintended users. - Cron scheduling: the skill uses openclaw cron. Verify that 'openclaw cron add' behaves as expected in your environment and that scheduled jobs do not leak tokens (e.g., via command-line arguments visible in process lists or logs). - Safer alternatives: consider using a deploy key or repository-specific token with minimal permissions, using a Git credential helper or GPG-encrypted secrets in the repo, or using a hosted backup solution. If you proceed, rotate the token after initial testing and limit its scope and lifetime. If you want, I can: (1) produce a safer version of the backup script that avoids writing the token into .git/config (for example, using a temporary credential helper or GIT_ASKPASS wrapper), (2) add a repository-creation step using the GitHub API/gh with explicit permission guidance, or (3) produce a checklist of files to exclude from backups.
功能分析
Type: OpenClaw Skill Name: alfred-github-backup Version: 1.0.0 The skill is a legitimate utility designed to back up the OpenClaw workspace to a user-defined private GitHub repository. It uses a shell script (scripts/backup.sh) to automate Git operations and correctly prompts the user for credentials (GitHub Token) and configuration. While storing a token in a Git remote URL is a known security weakness (vulnerability), the behavior is transparently documented in SKILL.md, aligns with the stated purpose, and contains no evidence of unauthorized data exfiltration or malicious intent.
能力评估
Purpose & Capability
The description claims the skill will 'create the repository' and fully automate setup, but neither SKILL.md nor scripts perform repository creation via the GitHub API or gh/HTTP calls. The script simply expects a GitHub username, repo name and token and pushes — so a pre-existing repo (or manual creation) is actually required. Also the SKILL.md and script reference both /root/.openclaw/workspace and ~/.openclaw/workspace inconsistently.
Instruction Scope
The runtime instructions ask the user to paste a repo-scoped GitHub token into the agent and then run git operations that will add and push files including skills/ and memory/. 'memory/' may contain sensitive secrets. The script embeds the token into the remote URL (git remote set-url https://x-access-token:[email protected]/...), which writes the token into the repository's .git/config in plaintext. The SKILL.md instructs scheduling via openclaw cron and running commands under /root, which implies root workspace access.
Install Mechanism
This is an instruction-only skill with a small shell script included; there is no install spec or remote download. That minimizes install-time risk.
Credentials
Requesting a GitHub token with repo scope is proportionate for pushing backups, but the agent asks the user to paste that token (sensitive) and the provided implementation stores it in git config (exfiltration risk if the workspace is shared). The skill does not declare required env vars explicitly, and there is no guidance to limit the token's scope or lifetime.
Persistence & Privilege
always:false and no install hook means the skill does not demand permanent/force-included privileges. It uses openclaw cron (normal for scheduled tasks) but does not modify other skills or global configs beyond the repository remote in the workspace.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install alfred-github-backup
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /alfred-github-backup 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
GitHub仓库备份技能 - 支持手动交互式配置向导和自动定时备份两种模式
元数据
Slug alfred-github-backup
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

alfred-github-backup 是什么?

GitHub 仓库备份技能 - 将 OpenClaw 工作空间备份到 GitHub 私有仓库。 支持两种模式:(1) 自动模式 - 定时自动备份 (2) 手动模式 - 交互式配置向导。 自动引导用户完成:GitHub Token 配置 → 仓库创建 → 初始化备份 → 设置定时任务。 用途:(1) 首次设置 (2... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 260 次。

如何安装 alfred-github-backup?

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

alfred-github-backup 是免费的吗?

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

alfred-github-backup 支持哪些平台?

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

谁开发了 alfred-github-backup?

由 ziqi(@ziqi-jin)开发并维护,当前版本 v1.0.0。

💬 留言讨论