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