内容简介:在国内,你们肯定发现使用git clone的速度实在太慢,git clone的速度可能会让你难以承受,现再次整理解决方法与大家分享,有图有真相。原因:git clone特别慢是因为github.global.ssl.fastly.net域名被限制了。只要找到这个域名对应的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可。
在国内,你们肯定发现使用git clone的速度实在太慢,git clone的速度可能会让你难以承受,现再次整理解决方法与大家分享,有图有真相。
原因:git clone特别慢是因为github.global.ssl.fastly.net域名被限制了。只要找到这个域名对应的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可。
适用各种操作系统,本次测试系统为Ubuntu 18.04.2 LTS,下载速度从几k提高到1M多。
没有修改前git clone速度实在慢只有10K左右,如上图。
修改后,git clone速度达到800多k。或者1M多。
1、查找域名对应的ip地址,并修改hosts文件
linuxidc@linuxidc:~/linuxidc.com$ nslookup github.global.ssl.fastly.Net
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: github.global.ssl.fastly.Net
Address: 151.101.229.194
linuxidc@linuxidc:~/linuxidc.com$ nslookup github.com
Server: 127.0.0.53
Address: 127.0.0.53#53
Non-authoritative answer:
Name: github.com
Address: 13.229.188.59
如下图:
然后修改hosts文件
Windows上的hosts文件路径在
C:\Windows\System32\drivers\etc\hosts
Linux的hosts文件路径在/etc/hosts中
sudo vim /etc/hosts
Mac的hosts文件路径也在/etc/hosts中
sudo vi /etc/hosts
在hosts文件末尾添加两行
github.com 13.229.188.59
github.global.ssl.fastly.Net 151.101.229.194
2、刷新DNS缓存
Linux:
sudo /etc/init.d/networking restart
Windows:
ipconfig /flushdns
Mac:
sudo killall -HUP mDNSResponder
以前的文章:git clone下载速度特慢的解决方案 https://www.linuxidc.com/Linux/2017-10/148116.htm
以上所述就是小编给大家介绍的《git clone速度太慢的解决办法》,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对 码农网 的支持!
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming Collective Intelligence
Toby Segaran / O'Reilly Media / 2007-8-26 / USD 39.99
Want to tap the power behind search rankings, product recommendations, social bookmarking, and online matchmaking? This fascinating book demonstrates how you can build Web 2.0 applications to mine the......一起来看看 《Programming Collective Intelligence》 这本书的介绍吧!