git clone速度太慢的解决办法

时间:2019-09-08 11:25:13   收藏:0   阅读:256

 

最近发现使用git clone的速度比较慢,于是找到了办法分享给大家:

思路:

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

实施:

  1. 在网站 https://www.ipaddress.com/ 分别搜索:
github.global.ssl.fastly.net
github.com

得到ip:


 
技术分享图片
github.global.ssl.fastly.net的ip

 
技术分享图片
github.com的ip
  1. 打开hosts文件
  • Windows上的hosts文件路径在C:\Windows\System32\drivers\etc\hosts
  • Linux的hosts文件路径在:sudo vim /etc/hosts
  1. 在hosts文件末尾添加两行(对应上面查到的ip)
151.101.185.194 github.global-ssl.fastly.net
192.30.253.112 github.com
  1. 保存更新DNS
  • Winodws系统的做法:打开CMD,输入ipconfig /flushdns
  • Linux的做法:在终端输入sudo /etc/init.d/networking restart
  1. 完成,试试git clone这条命令速度如何?

原文:https://www.cnblogs.com/lvdongjie/p/11484571.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!