提高git clone速度(linux系统)

想从git上面clone点东西,最近很多梯子也不能用了。发现下载速度很慢:

[root@VM_0_3_centos projects]# git clone [email protected]:google/earthenterprise.git
Cloning into 'earthenterprise'...
Warning: Permanently added the RSA host key for IP address '13.250.177.223' to the list of known hosts.
remote: Enumerating objects: 11, done.
remote: Counting objects: 100% (11/11), done.
remote: Compressing objects: 100% (11/11), done.
^CKilled by signal 2.8% (2907/15570), 69.48 MiB | 8.00 KiB/s    s   s  

8kb每秒的速度,不知道需要下载到什么时候。可以通过设置github.global.ssl.fastly.net的ip,修改DNS来提高速度。

先使用nslookup查看域名的ip

[root@VM_0_3_centos projects]# nslookup github.global.ssl.fastly.net
Server:		183.60.83.19
Address:	183.60.83.19#53

Non-authoritative answer:
Name:	github.global.ssl.fastly.net
Address: 151.101.109.194

[root@VM_0_3_centos projects]# nslookup github.com
Server:		183.60.83.19
Address:	183.60.83.19#53

Non-authoritative answer:
Name:	github.com
Address: 13.250.177.223


vim /etc/hosts
修改host,加入下面代码:

151.101.229.194 github.global.ssl.fastly.net
13.250.177.223 github.com

刷新网络设置

[root@VM_0_3_centos projects]# sudo /etc/init.d/network restart 
Restarting network (via systemctl):                        [  OK  ]

然后发现下载速度有了大幅提升了。已经提升到150k,还是有一定效果的。

你可能感兴趣的:(Unix_linux)