神奇的方法:一勞永逸解決Github的各種報錯
作者:AlphaCodeThinking
由于眾所周知的原因,我們從github下載資源庫的時候,總是會遇到各種的error。本文就告訴你一個一勞永逸的方案。
一、提出問題
由于眾所周知的原因,我們從github下載資源庫的時候,總是會遇到各種的error。
比如:
- 正在連接 raw.gith正在連接 raw.githubusercontent.com 失敗:
- 拒絕連接ubusercontent.com 失敗:拒絕連接
又比如:
- Failed to connect to raw.githubusercontent.com
- port 443: Connection refused
二、嘗試解決問題
我們可能嘗試多種方法解決卻最終無濟于事,比如修改hosts:

或者修改 DNS。然后遇到特殊情況,此方案無濟于事。
三、再次嘗試解決問題
我們嘗試“科學上網”解決問題,設置git的proxy。
- git config --global https.proxy http://127.0.0.1:1080
- git config --global https.proxy 'socks5://127.0.0.1:1080'
然而,proxy常常會被forbidden。
四、一勞永逸的方案
不再賣關子,直接上一勞永逸的方案,就是用某寶的鏡像:
- git config --global url.https://github.com.cnpmjs.org/.insteadof https://github.com/
如此設置之后,再無github的error之憂。
責任編輯:姜華
來源:
今日頭條