CommunityCoding & Developmentgithub.com

lg0219/github-ghclone

An acceleration tool for slow GitHub access in China: automatically rotates mirror prefixes with retries, sets up global git static acceleration and ghclone alias.

What is github-ghclone?

This skill addresses the common issue of slow or unreliable GitHub access from within mainland China's network, where direct connections to github.com are often throttled or blocked. It provides an automated solution that rotates through multiple community-maintained mirror proxies (such as gh-proxy.com) and includes a retry mechanism to handle transient failures. The skill installs a `ghclone` script that can be used directly or as a git alias, and also configures a global git URL override so that standard `git clone` commands benefit from the acceleration automatically. It is designed for use with Claude Code or any AI coding assistant that executes shell commands, enabling seamless cloning/fetching of repositories even under restrictive network conditions. The approach is simple, transparent, and easy to customize: users can add or remove proxy prefixes as needed and verify their availability with a provided test command.

Works with~Claude Code~Codex CLI~Cursor
npx skills add lg0219/github-ghclone

Installed? Explore more Coding & Development skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

Ask in your favorite AI

Open a new chat with this agent skill pre-loaded.

Documentation

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.

Related Skills