现象

浏览器可以打开github.com,但是通过git clone非常不稳定,使用fq代理也不行

原因分析

使用git命令和ping 域名可能是有区别。对于github.com在解析dns的时候有污染的情况。

翻看网上的资料有如下几个方法。

方法1,强制代理

 git config --global https.proxy http://127.0.0.1:1080
 git config --global http.proxy http://127.0.0.1:1080

1080替换成你的代理软件端口

方法2,设置/etc/hosts,并刷新DNS缓存 (mac电脑,window类似)

修改/etc/hosts

通过https://site.ip138.com/ 查看最快的ip

20.205.243.166 github.com
154.83.15.20 github.global.ssl.fastly.net
185.199.108.153 assets-cdn.github.com

刷新DNS

sudo killall -HUP mDNSResponder

其他

tips, ipv6可以试试其他路子

最后修改日期: 2023年2月2日

留言

撰写回覆或留言