git clone速度太慢的解决办法(亲测还有效)

国内,你们肯定发现使用git clone的速度实在太慢,git clone的速度可能会让你难以承受,现再次整理解决方法与大家分享,有图有真相

git clone速度太慢的解决办法(亲测还有效)

原因:git clone特别慢是因为github.global.ssl.fastly.net域名被限制了。只要找到这个域名对应的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可。

适用各种操作系统,本次测试系统为Ubuntu 18.04.2 LTS,下载速度从几k提高到1M多。

git clone速度太慢的解决办法(亲测还有效)

没有修改前git clone速度实在慢只有10K左右,如上图。

修改后,git clone速度达到800多k。或者1M多。

git clone速度太慢的解决办法(亲测还有效)

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

如下图:

git clone速度太慢的解决办法(亲测还有效)

然后修改hosts文件

Windows上的hosts文件路径

C:WindowsSystem32driversetchosts

Linux的hosts文件路径在/etc/hosts中

sudo vim /etc/hosts

git clone速度太慢的解决办法(亲测还有效)

Mac的hosts文件路径也在/etc/hosts中

sudo vi /etc/hosts

在hosts文件末尾添加两行

github.com 13.229.188.59
github.global.ssl.fastly.Net 151.101.229.194

git clone速度太慢的解决办法(亲测还有效)

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

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

栗子博客 软件 git clone速度太慢的解决办法(亲测还有效) https://www.lizi.tw/soft/14380.html

常见问题
  • 1、杰齐1.7仅适用于PHP5.2 2、需Zend支持 3、尽量使用宝塔面板 4、尽量使用Windows 系统,关关对Linux支持不太友好。
查看详情

相关文章

评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务

git clone速度太慢的解决办法(亲测还有效)-海报

分享本文封面