zl程序教程

您现在的位置是:首页 >  其他

当前栏目

神奇的方法:一劳永逸解决Github的各种报错

2023-03-09 22:19:37 时间

 一、提出问题

由于众所周知的原因,我们从github下载资源库的时候,总是会遇到各种的error。

比如:

  1. 正在连接 raw.gith正在连接 raw.githubusercontent.com 失败: 
  2. 拒绝连接ubusercontent.com 失败:拒绝连接 

 又比如:

  1. Failed to connect to raw.githubusercontent.com  
  2. port 443: Connection refused 

 二、尝试解决问题

我们可能尝试多种方法解决却最终无济于事,比如修改hosts:


或者修改 DNS。然后遇到特殊情况,此方案无济于事。

三、再次尝试解决问题

我们尝试“科学上网”解决问题,设置git的proxy。

  1. git config --global https.proxy http://127.0.0.1:1080 
  2. git config --global https.proxy 'socks5://127.0.0.1:1080' 

 

然而,proxy常常会被forbidden。

四、一劳永逸的方案

不再卖关子,直接上一劳永逸的方案,就是用某宝的镜像:

  1. git config --global url.https://github.com.cnpmjs.org/.insteadof https://github.com/ 

如此设置之后,再无github的error之忧。