
gitHub是一个面向开源及私有软件项目的托管平台,因为只支持git 作为唯一的版本库格式进行托管,故名gitHub。
2018年6月4日,微软方面发出通告,正式宣布计划以 75 亿美元的股票收购软件代码托管网站 GitHub,该桩交易预计在年底完成。
作为开源代码库以及版本控制系统,Github拥有超过900万开发者用户。随着越来越多的应用程序转移到了云上,Github已经成为了管理软件开发以及发现已有代码的首选方法。
由于GitHub国内的CDN已被污染,因此,在国内访问GitHub时,速度很慢,特别是下载。森哥常用到的加速方法有如下几个:
一、直接访问Gitee(码云)
前提是,Gitee上面也有想要的开源代码,而且,也不是我们今天所要表述的。所以这个忽略不提。
二、先将在境外的服务器上访问git clone下来后,再打包下载到本地,但这种方式,有几个问题:
2.1、成本问题,首选您得境外有服务器;
2.2、麻烦,折腾来折腾去的,而且,还不够及时。
所以,这一点,这里不也展开,大家知道一下就好了。
三、修改Hosts文件
这一点,是最直接也是最简单的。首先,需要做的就是要把相关的域名及对应的IP都找出来。当然了,当大家都去找这个,确实是很难为人的事情,不过,不用担心,森哥为大家整理了以下的IP列表,您只要懂得复制粘贴到hosts文件中就可以了。
192.30.253.112 github.com192.30.253.118 gist.github.com151.101.112.133 assets-cdn.github.com185.199.108.153 github.github.io151.101.184.133 githubusercontent.com151.101.184.133 raw.githubusercontent.com151.101.112.133 gist.githubusercontent.com151.101.184.133 cloud.githubusercontent.com151.101.112.133 camo.githubusercontent.com151.101.112.133 avatars0.githubusercontent.com151.101.112.133 avatars1.githubusercontent.com151.101.184.133 avatars2.githubusercontent.com151.101.12.133 avatars3.githubusercontent.com151.101.12.133 avatars4.githubusercontent.com151.101.184.133 avatars5.githubusercontent.com151.101.184.133 avatars6.githubusercontent.com151.101.184.133 avatars7.githubusercontent.com151.101.12.133 avatars8.githubusercontent.com151.101.185.194 github.global.ssl.fastly.net
四、通过代理解决
假设,您的本地代理端口为:1080 ,打开git base窗口进行按下列的方式设置。在Linux及OSX系统环境下测试通过。
4.1、全局代理(不推荐)
设置代理
git config --global http.proxy socks5://127.0.0.1:1080git config --global https.proxy socks5://127.0.0.1:1080
取消代理
git config --global --unset http.proxygit config --global --unset https.proxy
4.2、只对部分域名代理(推荐)
只对github进行代理,不会影响国内仓库。
git config --global http.https://github.com.proxy socks5://127.0.0.1:10808git config --global https.https://github.com.proxy socks5://127.0.0.1:10808