← Back to Skills Marketplace
d9g

GitHub 稳定获取

by d9g · GitHub ↗ · v2.1.0 · MIT-0
cross-platform ✓ Security Clean
101
Downloads
0
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install github-fetch
Description
提供多层备选方案,优先通过 SSH clone,其次使用 ghproxy 镜像及 jsdelivr CDN,解决国内 GitHub 连接不稳定问题。
README (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

Usage Guidance
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install github-fetch
  3. After installation, invoke the skill by name or use /github-fetch
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
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
Metadata
Slug github-fetch
Version 2.1.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is GitHub 稳定获取?

提供多层备选方案,优先通过 SSH clone,其次使用 ghproxy 镜像及 jsdelivr CDN,解决国内 GitHub 连接不稳定问题。 It is an AI Agent Skill for Claude Code / OpenClaw, with 101 downloads so far.

How do I install GitHub 稳定获取?

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

Is GitHub 稳定获取 free?

Yes, GitHub 稳定获取 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does GitHub 稳定获取 support?

GitHub 稳定获取 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created GitHub 稳定获取?

It is built and maintained by d9g (@d9g); the current version is v2.1.0.

💬 Comments