解决git clone 速度慢的问题

解决git clone 速度慢的问题

1.原因

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

2.解决步骤(亲测有效)

2.1 登录网站 https://www.ipaddress.com/

登录网站 https://www.ipaddress.com/ 分别搜索:

github.global.ssl.fastly.net
github.com

2.2 记录下对应的ip地址

2.3 修改hosts文件

Windows上的hosts文件路径在

C:\Windows\System32\drivers\etc\hosts

Linux的hosts文件路径在:

sudo gedit /etc/hosts

127.0.0.1	localhost

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters



# git config
140.82.114.3 github.com
151.101.1.194 github.global.ssl.fastly.net
151.101.65.194 github.global.ssl.fastly.net
151.101.129.194 github.global.ssl.fastly.net
151.101.193.194 github.global.ssl.fastly.net

172.65.251.78 gitlab.com
151.101.1.194 gitlab.global.ssl.fastly.net
151.101.65.194 gitlab.global.ssl.fastly.net
151.101.129.194 gitlab.global.ssl.fastly.net
151.101.193.194 gitlab.global.ssl.fastly.net


142.250.0.162 translate.googleapis.com
120.253.255.98 translate.googleapis.com
142.251.42.234 translate.googleapis.com
172.217.163.42 translate.googleapis.com
220.181.174.162 translate.googleapis.com

203.208.50.66 translate.googleapis.com

2.4 刷新DNS

Winodws系统的做法:打开CMD,输入

ipconfig /flushdns

Linux的做法:在终端输入

sudo /etc/init.d/networking restart

参考链接:https://blog.csdn.net/weixin_51331210/article/details/127169449

posted @ 2022-12-18 21:21  Xu_Lin  阅读(4375)  评论(0编辑  收藏  举报