自建反向代理网关,纯流式 HTTPS 转发,302 跳转已在服务端改写。只放行 GitHub 域名,不会被拿去当开放代理。
支持 github.com / raw.githubusercontent.com / gist.github.com / codeload.github.com;已带前缀的链接会自动剥掉,不会拼两层。
Archive、Release 的 302 已服务端改写,大文件边下边转,不缓冲到磁盘,不会下到一半断掉。
转发目标有域名白名单,非 GitHub 目标直接 403,别人拿到地址也盗不走流量。
wget / curl / git clone 都能直接加前缀,或配 git insteadOf 一劳永逸。
前缀代理、网页镜像、HTTP 代理、SOCKS5,同一台机器四种用法互不干扰。
https://gh.gt.kukqi.top/ + 原始完整链接| 类型 | 示例 | 状态 |
|---|---|---|
| Release 资产 | github.com/cli/cli/releases/download/v2.62.0/xxx.tar.gz | ✅ 已验证 13MB |
| 源码归档 | github.com/user/repo/archive/refs/heads/main.zip | ✅ 302 自动跟随 |
| Raw 原始文件 | raw.githubusercontent.com/user/repo/main/file | ✅ |
| Git Clone | git clone 前缀/github.com/user/repo.git | ✅ |
| Gist | gist.githubusercontent.com/… | ✅ |
| Patch / Diff | github.com/user/repo/pull/12.diff、.patch | ✅ |
| GitHub API | api.github.com/rate_limit 或 /_api/… | ✅ |
| Atom / RSS 订阅 | github.com/user/repo/releases.atom、/commits.atom | ✅ |
| GitHub Pages | user.github.io/… | ✅ |
| 网页浏览(镜像) | https://gh.gt.kukqi.top/ | ✅ 不含登录 |
| Actions 构建产物 | api.github.com/repos/…/actions/artifacts/… | ✕ 需登录令牌,不转发 |
| Docker 镜像 / GHCR | ghcr.io/… | ✕ 未部署 registry 代理 |
标 ✕ 的两项不是配置问题,是服务端能力边界:Actions 产物下载要走带 token 的鉴权接口,公开代理转发不了私有产物;Docker Registry 需要单独的 v2 协议代理,暂未搭建。
https://gh.gt.kukqi.top/https://github.com/…https://gh.gt.kukqi.top/(镜像站,不能登录)https://gh.gt.kukqi.top206.187.213.199:8899(HTTP)或 10808(SOCKS5),账号 gh_ry206.187.213.199 github.com# 下载 Release 资产 wget https://gh.gt.kukqi.top/https://github.com/cli/cli/releases/download/v2.62.0/gh_2.62.0_linux_amd64.tar.gz # 断点续传 curl -L -C - -O https://gh.gt.kukqi.top/https://github.com/…/xxx.tar.gz # 克隆仓库 git clone https://gh.gt.kukqi.top/https://github.com/hunshcn/gh-proxy.git
大文件建议加 -L 让客户端跟随 302;服务端已经把 Location 改写成自家域名,不会跳回 GitHub。
配一次 insteadOf,之后所有 git clone 自动走加速:
git config --global url."https://gh.gt.kukqi.top/https://github.com/".insteadOf "https://github.com/"
只想对某个仓库生效就去掉 --global。取消配置:
git config --global --unset url."https://gh.gt.kukqi.top/https://github.com/".insteadOf
配完先验证一下是否命中:git config --global --get-regexp insteadOf
子模块里写的是 https://github.com/…,配了上面的 insteadOf 之后递归克隆也会一起生效:
git clone --recursive https://gh.gt.kukqi.top/https://github.com/user/repo.git
已经克隆过但子模块没拉下来的,进目录执行:
git submodule sync --recursive git submodule update --init --recursive
sync 这一步很关键——子模块的 remote 地址被缓存过,不 sync 改配置不会生效。
能:浏览仓库首页、文件、README、Issues、Releases、搜索、看代码、下源码包和 Release(链接和资源都已改写)。
不能:登录、私有仓库、Settings、OAuth 授权、Star / 评论等写操作。原因是会话 cookie 和 CSRF token 绑在 github.com 域上,跨域镜像无法通过校验,这不是配置能绕过的。
要登录就用 hosts + 443 SNI 那条路:浏览器地址栏保持 github.com,证书和会话都是真的。
403 + 提示非 GitHub 域名 → 目标域名不在白名单,检查链接是否拼错或误带了别的站。404 → 前缀后面的原始链接不完整,注意保留 https:// 后的完整路径。302 不自动跟随 → wget 加 --max-redirect、curl 加 -L。curl -C - 续传,服务端是流式转发,断点续传支持取决于上游是否给 Range。Ctrl+F5。206.187.213.199。443 — SNI 透明转发,hosts 指向本机即可按原生域名访问 github.com8443 — 本站(镜像 + 前缀代理)的内部端口,外网经 443 按 SNI 分流进来8899 — HTTP/HTTPS 正向代理,带 BasicAuth10808 — SOCKS5 正向代理,同一套账号80 — 仅用于证书签发校验与纯文本提示正向代理是通用 HTTPS 代理(只放行 443/80 端口),带账号口令,请勿外传。
Git 那条执行后,本机所有 git clone https://github.com/… 都会自动走加速,不用再手写前缀。npm 那条是把 GitHub 依赖改成 tarball 直链的方式,仅对以 GitHub 地址声明的依赖有效。
自建自用,没有账号体系也没有配额限制,速度取决于这台机器到 GitHub 的链路和你的宽带。它不是商业机场,所以别拿它跑大规模分发。
服务端只转发 github.com、github.io、githubusercontent.com、githubassets.com 及其子域。别的站点一律 403 —— 这是防止被人当成开放代理用的硬限制。
不能。原因是跨域会话与 CSRF 校验。需要登录、私有仓库、提交代码,请走 443 SNI + hosts 那条原生域名通道。
用支持续传的命令重试:
curl -L -C - -O https://gh.gt.kukqi.top/https://github.com/…/file.tar.gz
如果上游没有返回 Accept-Ranges,就只能从头下。
先试浅克隆,能省掉大半流量:
git clone --depth 1 https://gh.gt.kukqi.top/https://github.com/user/repo.git
需要历史再 git fetch --unshallow。另外 git config --global http.postBuffer 524288000 对 push 大包有用,对 clone 无效。