Github:提交代码到Github上报错Git: fatal unable to access "***/: Failed to connect to github.com port 443 after 21074 ms: Couldn't connect to server的解决

在国内网环境,使用VScode提交代码到Github上时,因为国的防火墙问题,经常会报错:

Git: fatal unable to access "https://github.com/***/***.io.git/:
Failed to connect to github.com port 443 after 21074 ms: Couldn't connect to server

 

可能原因:

出现该错误是因为使用了proxy代理(如使用了梯子),所以要解决该问题,核心操作就是要取消代理;

 解决方法1:

1.通过git配置文件查看是否使用代理:git config --global http.proxy;

2.通过查询系统环境有没有使用代理:env|grep -I proxy

3.通过git取消代理:

  • git config --global --unset http.proxy
  • git config --global --unset https.proxy

4.通过系统命令取消代理:

  • unset http_proxy
  • unset ftp_proxy
  • unset all_proxy
  • unset https_proxy
  • unset no_proxy

解决方法2:

1.通过CMD命令 ping github.com,发现Ping不通

2.访问githubIP检测,获取到真实IP,

 

3.在hosts文件中加入如下三行:

  • 140.82.112.3 github.com
  • 199.232.5.194 github.global.ssl.fastly.net
  • 54.231.114.219 github-cloud.s3.amazonaws.com

 

注:hosts文件路径:C:\Windows\System32\drivers\etc

4.再次Push或者Pull即可。

 

 





posted @ 2023-07-17 18:04  coderjim  阅读(1492)  评论(0编辑  收藏  举报

更多知识请点击——

www.7017online.xyz