最近发现应用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:WindowsSystem32driversetchosts
  • Linux的hosts文件门路在:sudo vim /etc/hosts
  1. 在hosts文件开端增加两行(对应下面查到的ip)
199.232.69.194 github.global-ssl.fastly.net140.82.112.3 github.com 
  1. 保留更新DNS
  • Winodws零碎的做法:关上CMD,输出ipconfig /flushdns
  • CentOS的做法:在终端输出nscd -i hosts
  1. 实现,试试git clone这条命令速度如何?