Community编程与开发github.com

lg0219/github-ghclone

国内(中国大陆网络)GitHub 访问慢、clone/fetch 掉线时的加速方案。自动轮换 GitHub 加速前缀并带重试,配好 git 全局静态加速 + ghclone 别名。

github-ghclone 是什么?

github-ghclone is a Claude Code agent skill that 国内(中国大陆网络)GitHub 访问慢、clone/fetch 掉线时的加速方案。自动轮换 GitHub 加速前缀并带重试,配好 git 全局静态加速 + ghclone 别名。.

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add lg0219/github-ghclone

Installed? Explore more 编程与开发 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

GitHub GHClone - GitHub Acceleration Skill for China

Use Cases

Enable this skill when users encounter the following issues within China's network:

  • git clone https://github.com/... is slow, hangs, shows Recv failure: Connection reset by peer, or times out
  • Direct access to GitHub website / API is unstable or completely blocked (curl https://github.com returns 0 bytes)
  • Need to batch clone GitHub repositories, download Release files, or raw files

Core idea: redirect access to github.com through domestically reachable acceleration prefixes (mirror proxies), and perform automatic rotation + retry across multiple prefixes. If a single prefix hangs, the process doesn't freeze; it automatically switches to the next one.

One-Click Installation

# Clone this repository (you can also clone it using an available prefix)
git clone https://gh-proxy.com/https://github.com/OWNER/github-ghclone.git
cd github-ghclone
bash scripts/install.sh
source ~/.bashrc   # make ~/bin effective

After installation you get:

  • ~/bin/ghclone — executable script (auto-rotates 3 prefixes, 3 retries per prefix)
  • Global git static acceleration url."https://gh-proxy.com/https://github.com/".insteadOf (so regular git clone benefits immediately)
  • Git alias gclone → ghclone

Usage

# Method 1: Direct script call
ghclone https://github.com/owner/repo.git --depth 1

# Method 2: Git alias
git gclone https://github.com/owner/repo.git --depth 1

# Regular git command (already globally accelerated, no alias needed)
git clone https://github.com/owner/repo.git

ghclone automatically detects which prefix is currently available. If successful, it returns; only if all fail does it report an error.

Manual Configuration (if you don't want to run install.sh)

  1. Download the script (the repository's bin/ghclone), put it in ~/bin/ and chmod +x.
  2. Global git static acceleration (choose one currently available prefix):
    git config --global url."https://gh-proxy.com/https://github.com/".insteadOf "https://github.com/"
    
  3. Git alias:
    git config --global alias.gclone '!~/bin/ghclone'
    
  4. PATH: ensure ~/bin is in your PATH (append to ~/.bashrc):
    export PATH="$HOME/bin:$PATH"
    

Changing / Adding / Removing Prefixes (when a prefix hangs)

Acceleration prefixes are community-maintained proxies, available intermittently, so rotation is necessary:

  • Edit the PATS=(...) array in ~/bin/ghclone (or the repository's bin/ghclone) to add or remove prefixes.
  • Change the global git static prefix:
    # Replace with a new available prefix
    git config --global url."https://new-prefix/https://github.com/".insteadOf "https://github.com/"
    # Clear the old prefix
    git config --global --unset url."https://old-prefix/https://github.com/".insteadOf
    

Verifying Prefix Availability

Test each prefix against a small real repository (returns a commit hash if available, 0 bytes/error if unavailable):

for p in https://gh-proxy.com https://ghfast.top https://ghproxy.net; do
  n=$(git ls-remote "$p/https://github.com/octocat/Hello-World.git" HEAD 2>/dev/null | head -1)
  echo "$p -> ${n:-unavailable}"
done

Known Available Prefixes (tested Oct 2026, subject to change)

PrefixUsage
https://gh-proxy.comhttps://gh-proxy.com/https://github.com/owner/repo.git
https://ghfast.tophttps://ghfast.top/https://github.com/owner/repo.git
https://ghproxy.nethttps://ghproxy.net/https://github.com/owner/repo.git

Direct access to github.com in China typically returns 0 bytes (blocked) — always use prefixes. Prefix services are unstable; ghclone's retry logic is designed precisely to handle transient failures like "Connection reset by peer".

Limitations & Notes

  • Prefix proxies are third-party community services; their availability, speed, and lifespan are not guaranteed. If all fail, you need to find new prefixes and update the PATS array.
  • Only accelerates github.com git protocol access; subdomains like objects.githubusercontent.com (for large Release files) can also be wrapped via prefixes.
  • Compliance note: ensure you use egress methods that comply with local regulations.

相关技能