← 返回 Skills 市场
d9g

GitHub 稳定获取

作者 d9g · GitHub ↗ · v2.1.0 · MIT-0
cross-platform ✓ 安全检测通过
101
总下载
0
收藏
0
当前安装
3
版本数
在 OpenClaw 中安装
/install github-fetch
功能描述
提供多层备选方案,优先通过 SSH clone,其次使用 ghproxy 镜像及 jsdelivr CDN,解决国内 GitHub 连接不稳定问题。
使用说明 (SKILL.md)

github-fetch 技能 v2.0

描述

稳定获取 GitHub 项目内容的技能。解决国内 GitHub 连接不稳定问题,提供多层备选方案。

v2.0 优化

  1. SSH 预检测有效性(节省 ~60s)
  2. 浅克隆默认化(速度快 10x)
  3. 分支自动探测(main/master)
  4. 目标目录防覆盖
  5. 多 CDN fallback
  6. 细化错误信息
  7. Git LFS 提示

使用场景

当用户提到:

  • "克隆 xxx 项目"
  • "从 GitHub 获取"
  • "GitHub 不通"
  • "git clone 失败"
  • "下载 GitHub 项目"

时自动启用。

优先级策略

优先级 方案 端口 说明
1 SSH clone 22 已配置有效 SSH key 时最稳定
2 ghproxy 镜像 443 国内加速镜像(多站点轮换)
3 原 HTTPS 443 最后尝试

脚本

github-clone.sh

# 浅克隆(默认,--depth 1)
github-clone.sh https://github.com/d9g/page-build.git

# 指定目录
github-clone.sh https://github.com/d9g/page-build.git ~/projects

# 完整克隆
github-clone.sh https://github.com/d9g/page-build.git ~/projects --full

优化点

功能 说明
SSH 预检测 ssh -T [email protected] 验证 key 有效性,无效则跳过
浅克隆默认 --depth 1 减少下载量,完整克隆需 --full
目录检查 目标已存在则自动加时间戳后缀
分支探测 调用 GitHub API 探测 main/master
错误分类 区分:超时/拒绝/key无效/仓库不存在/目录已存在
LFS 提示 检测 .gitattributes 中的 lfs 标记

github-fetch-file.sh

# 获取单个文件(自动探测分支)
github-fetch-file.sh d9g/page-build README.md

# 指定分支
github-fetch-file.sh d9g/page-build config.yml master

# 指定输出路径
github-fetch-file.sh d9g/page-build src/main.py main output.py

CDN fallback 顺序

CDN 限制 说明
jsdelivr 50MB 全球 CDN,速度快
ghproxy - 国内加速镜像
raw.githubusercontent.com - GitHub 原始文件

优化点

功能 说明
分支探测 调用 GitHub API 或尝试 main→master
CDN fallback jsdelivr → ghproxy → raw 依次尝试
文件大小警告 >50MB 时提示 jsdelivr 可能失败
错误分类 区分:404/503/超时

URL 转换规则

HTTPS → SSH

https://github.com/d9g/page-build.git
→ [email protected]:d9g/page-build.git

HTTPS → ghproxy

https://github.com/d9g/page-build.git
→ https://ghproxy.com/https://github.com/d9g/page-build.git

GitHub → jsdelivr

https://github.com/d9g/page-build/blob/main/README.md
→ https://cdn.jsdelivr.net/gh/d9g/page-build@main/README.md

错误类型对照表

错误 类型 建议
Connection timed out 超时 检查网络或稍后重试
Connection refused 拒绝 端口被防火墙阻断
Host key verification failed SSH host key ssh-keyscan github.com >> ~/.ssh/known_hosts
Permission denied key 未绑定 检查 GitHub Settings → SSH Keys
Repository not found 仓库不存在 检查仓库地址
already exists 目录已存在 删除或换目录
HTTP 404 文件不存在 检查路径或分支名
HTTP 503 CDN 过载 稍后重试或换 CDN

配置 SSH Key

# 生成 SSH key
ssh-keygen -t ed25519 -C "[email protected]"

# 查看公钥(添加到 GitHub)
cat ~/.ssh/id_ed25519.pub

# 验证连接
ssh -T [email protected]
# 成功: Hi xxx! You've successfully authenticated...

记录

每次成功获取后,在 TOOLS.md 中记录:

### GitHub 连接(实测 YYYY-MM-DD)

- SSH(端口 22):✅ 稳定(key 已绑定)
- HTTPS(端口 443):⚠️ 不稳定
- ghproxy 镜像:⚠️ 部分可用
- jsdelivr CDN:✅ 稳定(单文件,\x3C50MB)

推荐:优先使用 SSH clone

v2.0 - 2026-04-13

安全使用建议
This skill appears to do what it says (help fetch/clone GitHub repos using SSH, ghproxy, jsdelivr, or raw). Before installing or running it: 1) Review the provided scripts yourself (they are included) to confirm you are comfortable running them. 2) Ensure you have the required local tools (git, ssh, curl, timeout) — the skill does not declare these but needs them. 3) Be aware the scripts read ~/.ssh keys and may use your local git/SSH credentials; if you don't want that, run the script in a sandbox or remove keys. 4) The SSH probe uses StrictHostKeyChecking=no which bypasses host-key checking for the probe step; consider running 'ssh-keyscan github.com >> ~/.ssh/known_hosts' beforehand or editing the script to avoid disabling host-key checks. 5) Using ghproxy/jsdelivr routes requests through third parties — do not use those for private repositories or sensitive files, as CDNs/mirrors can see request metadata or cached content. 6) Use the --probe option first to see which mirrors are reachable and test in a safe environment if you have high security requirements.
能力评估
Purpose & Capability
The SKILL.md and both scripts implement the described multi-tier GitHub retrieval (SSH, ghproxy, jsdelivr, raw). However the manifest did not declare required local binaries even though the scripts invoke git, ssh, curl, timeout, mkdir, and grep; this is a documentation/metadata omission rather than functional mismatch.
Instruction Scope
Instructions and scripts access local SSH key files (~/.ssh/id_*.pub and .ssh operations) and repository files (.gitattributes) which is appropriate for cloning, but the ssh precheck uses 'ssh -T ... -o StrictHostKeyChecking=no' which suppresses host-key verification for the probe (convenient but weakens MITM protection). The skill also makes network requests to GitHub API, ghproxy mirrors, jsdelivr CDN, and raw.githubusercontent — all consistent with its purpose.
Install Mechanism
No install spec (instruction-only plus included shell scripts). Nothing is downloaded or executed from external arbitrary URLs during install; all logic is in the provided scripts. This is the low-risk pattern for such a utility.
Credentials
The skill requests no environment variables or credentials. It does read local SSH key files and will use local git/ssh credentials if available — this is proportionate for cloning, but users should be aware the scripts will access ~/.ssh and may use your keys present there.
Persistence & Privilege
always:false and user-invocable: true. The skill does not request permanent platform-level presence or attempt to modify other skills or global agent settings. It will not autonomously escalate privileges beyond normal agent invocation.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install github-fetch
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /github-fetch 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v2.1.0
v2.1 新增:--oref 指定tag/commit、--probe 探测模式、--timeout 自定义超时、--branch 指定分支
v2.0.0
v2.0 优化:SSH预检测、浅克隆默认、分支自动探测、目录防覆盖、多CDN fallback、细化错误信息、Git LFS提示
v1.0.0
解决国内 GitHub 连接不稳定问题,优先 SSH 方式,备选 ghproxy 镜像和 jsdelivr CDN
元数据
Slug github-fetch
版本 2.1.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 3
常见问题

GitHub 稳定获取 是什么?

提供多层备选方案,优先通过 SSH clone,其次使用 ghproxy 镜像及 jsdelivr CDN,解决国内 GitHub 连接不稳定问题。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 101 次。

如何安装 GitHub 稳定获取?

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

GitHub 稳定获取 是免费的吗?

是的,GitHub 稳定获取 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

GitHub 稳定获取 支持哪些平台?

GitHub 稳定获取 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 GitHub 稳定获取?

由 d9g(@d9g)开发并维护,当前版本 v2.1.0。

💬 留言讨论