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或同步资源仍很慢,使用FQ工具后需配置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
posted @ 2018-02-01 00:06  Jarvis_Xu  阅读(9017)  评论(1编辑  收藏  举报