Problem entry · machine-readable · 编码代理与终端

GitHub 直连慢/失败(clone 被重置、443 连不上、SSH 认证、Release 下载中断)

本页嵌入 #trove-entity JSON(本条目全量结构化数据);全库数据见 /agent/trove.json。

元数据

idgithub-direct-connect-fail收录2026-08-30
问题域编码代理与终端主题分组网络与镜像
适用工具git · 外部工具

症状

- `git clone` 卡在 Cloning repository 后报 `Connection reset by peer` / 超时;

- `Failed to connect to github.com port 443`;

- `SSH authentication failed` / `Permission denied (publickey)`;

- 公开仓库也报 `Please make sure you have the correct access rights and the repository exists`;

- Release / zip / tarball 下载反复断连、TLS 中断;

- 部分 CLI 失败时 exit 码仍为 0(坑)。

原因

国内出口到 GitHub 直连不稳定(Release 资产另走 `objects.githubusercontent.com`,链路更差);老教程留下的 HTTPS→SSH 全局重写规则与失效代理残留放大问题;SSH key / gh 凭据 / 账号状态异常时,连公开仓库也被拒。

解法

1. 分层诊断:`curl https://github.com/` + `GIT_CONFIG_GLOBAL=/dev/null git ls-remote` 区分网络层/配置层/凭据层;

2. 网络层换通道:gh-proxy 前缀、codeload tarball、浅克隆、显式代理、错峰/换网络;SSH 被墙时走官方 443 通道(ssh.github.com);2. 网络层换通道:gh-proxy 前缀、codeload tarball、浅克隆、显式代理、错峰/换网络;

3. 安装类换不依赖 GitHub 的路径:pip 清华镜像、tarball 手工复制;判断成功看产物不看 exit 码;

4. 配置层删重写规则与失效代理;凭据层强制 HTTPS / gh 重新授权;

5. 下载后校验大小/结构。

验证证据

- 2026-08-29 实测:`GIT_CONFIG_GLOBAL=/dev/null git ls-remote https://github.com/octocat/Hello-World.git` 匿名返回全部 refs;`--unset-all url.git@github.com:.insteadof` 后公开仓库 clone 成功。

- 2026-08-28 实测:CLI clone 被重置(Recv failure: Connection reset by peer),gh-proxy codeload tarball 277KB 秒级完成,24 技能目录就位。

- 2026-08-28 实测:SSH 认证失败 → 强制 HTTPS `insteadOf` 后 `SSH not configured, cloning via HTTPS` + marketplace 添加成功。

- 2026-08-28 实测:codeload tarball 544K / 2.1s 稳定;gh-proxy 7.8s 可用;raw 端点探针超时统一避开。

- 2026-08-28 实测:gh-proxy 下载 13.5MB 秒级,deb 结构确认 exit=0;直连 assets 断连。

- 收录走 PyPI 清华镜像成功;GitHub 直连风险在连通性记录标注。

- 未实测:各镜像加速站的生命周期(有挂/变慢风险,用前先测);完整企业网络环境(代理白名单等)。

来源与证据

素材来源:本站同根合并整理(2026-08-30)

验证证据:Evidence details kept locally (2026-08-29)