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 @   coderjim  阅读(3355)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· winform 绘制太阳,地球,月球 运作规律
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
· 超详细:普通电脑也行Windows部署deepseek R1训练数据并当服务器共享给他人

更多知识请点击——

www.7017online.xyz
点击右上角即可分享
微信分享提示