git clone 下載速度慢的解決方法
- 在https://www.ipaddress.com 查找
http://github.com和http://global-ssl.fastly.Net對應的IP地址,例如:192.30.253.112對應的http://github.com151.101.185.194對應的github.global.ssl.fastly.net
Mac下:
-
打開文件路徑
/etc/hosts,拷貝出該hosts文件; -
將下列內容加入到拷貝出的
hosts文件中:192.30.253.112 github.com 151.101.185.194 github.global.ssl.fastly.net 151.101.184.249 global-ssl.fastly.net 185.199.111.153 assets-cdn.github.com -
用拷貝出的文件替換
hosts文件; -
打開終端:輸入以下內容,刷新DNS緩存:
sudo dscacheutil -flushcache
Windows下:
-
用記事本打開
hosts文件(路徑在:C:\Windows\System32\drivers\etc\hosts) -
將下列內容加入到拷貝出的
hosts文件中:192.30.253.112 github.com 151.101.185.194 github.global.ssl.fastly.net 151.101.184.249 global-ssl.fastly.net 185.199.111.153 assets-cdn.github.com -
打開終端:輸入以下內容,刷新DNS緩存:
ipconfig /flushdns
