一、提出问题
由于众所周知的原因,我们从github下载资源库的时候,总是会遇到各种的error。
比如:
正在连接raw.gith正在连接raw.githubusercontent.com失败:
拒绝连接ubusercontent.com失败:拒绝连接
又比如:
Failedtoconnecttoraw.githubusercontent.com
port443:Connectionrefused
二、尝试解决问题
我们可能尝试多种方法解决却最终无济于事,比如修改hosts:
或者修改 DNS。然后遇到特殊情况,此方案无济于事。
三、再次尝试解决问题
我们尝试“科学上网”解决问题,设置git的proxy。
gitconfig--globalhttps.proxyhttp://127.0.0.1:1080
gitconfig--globalhttps.proxy'socks5://127.0.0.1:1080'
然而,proxy常常会被forbidden。
四、一劳永逸的方案
不再卖关子,直接上一劳永逸的方案,就是用某宝的镜像:
gitconfig--globalurl.https://github.com.cnpmjs.org/.insteadofhttps://github.com/
如此设置之后,再无github的error之忧。
原文地址:https://www.toutiao.com/i6935737939641106975/