家里连不上github

1.查询可以用的IP

ip通过在https://www.ipaddress.com/上分别搜索

github.com -> 140.82.114.4
github.global-ssl.fastly.net -> 199.232.69.194

2.更改hosts文件

文件地址 C:\Windows\System32\Drivers\etc\hosts

在文件结尾添加

140.82.114.4 github.com 
199.232.69.194 github.global.ssl.fastly.net

3.打开cmd输入ipconfig/flushdns刷新缓存

4.git push时提示 Failed to connect to github.com port 443: Timed out

在git项目在本地的根目录下执行下面的命令:

git config --global --unset http.proxy

如果还不行,就把以前的远程地址删除,重新添加,再提交
删除远程地址

git remote rm origin

添加(origin 名称可根据需要添加)

git remote add origin https://xxxxxxx 仓库地址

再次执行去掉代理

git config --global --unset http.proxy

5.ip地址不是固定的!!!当你发现又连不上的时候需要检查下ip是否变了

posted @ 2021-03-12 23:42  PiPai  阅读(743)  评论(0编辑  收藏  举报