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

https://www.linuxidc.com/Linux/2019-05/158461.htm

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

原文地址:https://www.cnblogs.com/rxbook/p/11869835.html