Failed to connect to github.com port 443

发布于:2024-10-18 ⋅ 阅读:(8) ⋅ 点赞:(0)

问题1

Failed to connect to github.com port 443 after 21075 ms: Connection refused连接超时,使用代理

关于代理

方法一:取消代理设置

查看配置

git config --global -l	

如果并未使用VPN,但依然遇到端口443连接失败的问题,尝试取消Git的代理设置:

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

git命令

启用命令

git config --global http.proxy 127.0.0.1:7890
git config --global https.proxy 127.0.0.1:7890

其他命令

设置全局 Git 用户名和邮箱
若是第一次使用 git 的话,请先配置全局的用户名和邮箱(将以下命令用户名邮箱替换)。

git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"

配置完成后,可以通过以下命令确认这些信息:

git config --list
user.name=Your Name
user.email=youremail@yourdomain.com

ctrl+f1+f5

其他解决方案

1. 设置 Git 使用 HTTP 而不是 HTTPS

如果问题仍然存在,你可以临时将 Git 配置为使用 HTTP 而不是 HTTPS:

git remote set-url origin http://github.com/LYL1129/webserver.git

然后尝试再次推送:

git push -u origin main

请注意,使用 HTTP 连接会降低安全性,建议只作为临时解决方案。

2. 检查证书

确保你的系统信任 GitHub 的 SSL 证书。你可以尝试重新安装根证书:

sudo apt install --reinstall ca-certificates

3. 配置 Git 忽略 SSL 验证(不推荐)

作为最后的手段,你可以配置 Git 忽略 SSL 证书验证,但这会降低安全性:

git config --global http.sslVerify false

请在问题解决后立即将 SSL 验证重新启用:

git config --global http.sslVerify true

4. 检查代理设置

如果你通过代理访问互联网,确保你的代理设置正确。可以配置 Git 使用代理:

git config --global http.proxy http://proxyuser:proxypassword@proxy.server.com:port

总结

启动代理http代理,关掉ssl证书验证


网站公告

今日签到

点亮在社区的每一天
去签到