bash访问github的问题

320 阅读1分钟

想用git bash访问github上的项目,但git clone时总是出现如下问题

$ git clone github.com/schacon/tic… Cloning into 'ticgit'... fatal: unable to access 'github.com/schacon/tic…': Failed to connect to github.com port 443 after 2049 ms: Connection refused

期间在网上搜解决方法时大部分都是代理问题,但我并没有设置代理最后通过一篇博客发现了问题出现在DNS污染。对于windows系统,解决方法是找到 C:\Windows\System32\drivers\etc\hosts文件
并在末端加上
20.205.243.166 github.com
20.205.243.160 ssh.github.com
问题便可以得到解决 其中这两个IP的获取方法是在命令行输入
nslookup github.com 8.8.8.8(获取github IP地址)
nslookup ssh.github.com 8.8.8.8 (获取ssh.github IP地址)
原文章如下
juejin.cn/post/710373…