问题
github访问不稳定,时而可以时而不行。今天要clone上面的代码到本地,发现git clone报如下错误:
fatal: unable to access 'https://github.com/greyli/helloflask.git/': Failed to connect to github.com port 443 after 21099 ms: Couldn't connect to server
浏览器访问github.com也报404
解决
网上查了一下解决办法,最简单可行的办法就是做域名查询
github.com, 比如在https://tool.chinaz.com/dns/github.com
查询结果如下,请**注意使用ip在foreign的**。
然后先ping一下,如果能ping通即可用。
然后在C:\Windows\System32\drivers\etc增加
140.82.121.4 github.com
键盘上按下win+r快捷打开cmd窗口,刷新本地电脑dns缓存。
ipconfig /flushdns
验证
git clone https://github.com/greyli/helloflask.git
成功