git 速度优化
在国内,使用git clone的速度慢
1、原因:git clone特别慢是因为github.global.ssl.fastly.net域名被限制了。只要找到这个域名对应的ip地址,然后在hosts文件中加上ip–>域名的映射,刷新DNS缓存便可。
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 然后修改hosts文件 Windows上的hosts文件路径在 C:\Windows\System32\drivers\etc\hosts Linux的hosts文件路径在/etc/hosts中 sudo vim /etc/hosts Mac的hosts文件路径也在/etc/hosts中 sudo vi /etc/hosts 在hosts文件末尾添加两行 https://github.com 13.229.188.59 https://github.global.ssl.fastly.Net 151.101.229.194 2、刷新DNS缓存 Linux: sudo /etc/init.d/networking restart Windows: ipconfig /flushdns Mac: sudo killall -HUP mDNSResponder
2、改git地址
举个例子:
比如原地址是“https://github.com/996.git”
改成“https://github.com.cnpmjs.org/996.git”便可搞定!
                    
                
                
            
        
浙公网安备 33010602011771号