← Back to Skills Marketplace
ziqi-jin

alfred-github-backup

by ziqi · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
260
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install alfred-github-backup
Description
GitHub 仓库备份技能 - 将 OpenClaw 工作空间备份到 GitHub 私有仓库。 支持两种模式:(1) 自动模式 - 定时自动备份 (2) 手动模式 - 交互式配置向导。 自动引导用户完成:GitHub Token 配置 → 仓库创建 → 初始化备份 → 设置定时任务。 用途:(1) 首次设置 (2...
README (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"
  • "配置定时备份"
Usage Guidance
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.
Capability Analysis
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install alfred-github-backup
  3. After installation, invoke the skill by name or use /alfred-github-backup
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
GitHub仓库备份技能 - 支持手动交互式配置向导和自动定时备份两种模式
Metadata
Slug alfred-github-backup
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is alfred-github-backup?

GitHub 仓库备份技能 - 将 OpenClaw 工作空间备份到 GitHub 私有仓库。 支持两种模式:(1) 自动模式 - 定时自动备份 (2) 手动模式 - 交互式配置向导。 自动引导用户完成:GitHub Token 配置 → 仓库创建 → 初始化备份 → 设置定时任务。 用途:(1) 首次设置 (2... It is an AI Agent Skill for Claude Code / OpenClaw, with 260 downloads so far.

How do I install alfred-github-backup?

Run "/install alfred-github-backup" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is alfred-github-backup free?

Yes, alfred-github-backup is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does alfred-github-backup support?

alfred-github-backup is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created alfred-github-backup?

It is built and maintained by ziqi (@ziqi-jin); the current version is v1.0.0.

💬 Comments