美文网首页前端之他山之石
git clone速度太慢的解决办法

git clone速度太慢的解决办法

作者: 蜡笔刘 | 来源:发表于2018-11-09 15:10 被阅读37次

最近发现使用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这条命令速度如何?

相关文章

网友评论

    本文标题:git clone速度太慢的解决办法

    本文链接:https://www.haomeiwen.com/subject/rmloxqtx.html