ubuntu加速github


眾所周知的原因,github的網站訪問及代碼同步相當慢

 

設置hosts

1. 登錄http://tool.chinaz.com/dns/

2. 查詢以下域名映射,並分別取訪問速度較快的一個ip

github.global.ssl.fastly.net   ->   151.101.229.194

assets-cdn.github.com        ->   151.101.229.194

3. 將查詢到的ip和域名設置到host中

sudo vim /etc/hosts

 在hosts中加入查詢結果

151.101.229.194 github.global.ssl.fastly.net
151.101.229.194 assets-cdn.github.com

 保存,退出,並重啟網絡

/etc/init.d/networking restart

 此時訪問網頁速度提升明顯

 

設置proxy

  clone或同步資源仍很慢,使用翻牆工具后需配置git 的 proxy代理,具體為:

1. 查詢vpn在本機的proxy,如127.0.0.1:40641

2. 將該代理配置至git

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

3. source ~/.bashrc使能,此時github即可走vpn代理,飛速下載資源

4. 若需要取消代理,可使用

git config --global --unset http.proxy
git config --global --unset https.proxy


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM