如何解决git,Failed to connect to github.com port 443: Timed out问题

在使用Git推送或拉取代码时,若遇到Failed to connect to github.com port 443: Timed out错误,通常是网络连接或DNS解析问题导致。本文将提供分步解决方案,并解答fatal: early EOF等关联问题,帮助开发者快速恢复Git操作。

GitHub端口443超时原因解析

当Git尝试通过**HTTPS(端口443)**连接GitHub时,可能因以下原因失败:

  • 网络限制:防火墙、代理或VPN拦截443端口通信。

  • DNS污染:本地DNS无法正确解析 github.com 域名。

  • GitHub服务器IP变更:未及时更新本地IP缓存。

解决Failed to connect to github.com port 443的完整步骤

步骤1:查询GitHub最新IP地址

  • 访问 ipaddress.com

  • 输入 github.com 并搜索,获取当前IPv4地址(如140.82.113.4)。

步骤2:修改hosts文件强制指向正确IP

Windows系统:

# 用管理员权限打开记事本,编辑以下文件:
C:\Windows\System32\drivers\etc\hosts
# 添加一行(示例IP,需替换为实际查询结果):
140.82.113.4 github.com

Mac/Linux系统:

sudo nano /etc/hosts
# 添加相同格式的IP映射

又或者动手设置 host 文件,如下图所示:

如何解决git,Failed to connect to github.com port 443: Timed out问题

步骤3:刷新DNS缓存

  • Windows:命令行执行 ipconfig /flushdns

  • Mac:执行 sudo killall -HUP mDNSResponder

  • Linux:执行 systemctl restart network-manager

验证是否修复:

ping github.com  # 检查是否解析为新IP
git clone https://github.com/your-repo.git  # 测试Git操作

扩展问题:如何修复fatal: early EOF错误

若遇到fatal: early EOF或index-pack failed,通常由网络不稳定或仓库过大导致:

1、调整Git缓冲区大小:

git config --global http.postBuffer 524288000  # 设置为500MB

2、浅层克隆降低负载:

git clone --depth 1 https://github.com/your-repo.git

3、更换网络环境:尝试使用有线网络或更稳定的代理。

4、又或者查看:如何解决fatal: early EOF,fatal: index-pack failed 问题

其他排查建议

  • 关闭代理或VPN:部分工具会干扰Git的443端口通信。

  • 检查防火墙设置:确保443端口未被系统或安全软件拦截。

  • 使用SSH替代HTTPS:文章来源地址https://www.toymoban.com/article/117.html

    git remote set-url origin git@github.com:user/repo.git

到此这篇关于如何解决git,Failed to connect to github.com port 443: Timed out问题的文章就介绍到这了,更多相关内容可以在右上角搜索或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

原文地址:https://www.toymoban.com/article/117.html

如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请联系站长进行投诉反馈,一经查实,立即删除!

领支付宝红包赞助服务器费用

相关文章

  • git提交Failed to connect to github.com port 443解决方法

    最近在提交代码到GitHub,一直提示提交失败 Push: unable to access \\\'https://github.com/username/project.git/\\\': Failed to connect to github.com port 443 after 21140 ms: Couldn\\\'t connect to server ,我以为是网络太差了,直接使用代理软件,还是同样的提示, 所以咨询了一位优秀的前端开发kaimo,才知道需要g

    2024年01月25日
    浏览(11)
  • Git报错: Failed to connect to github.com port 443 解决方案

    Git报错: Failed to connect to github.com port 443 解决方案

    两种情况: 第一种情况自己有vpn ,网页可以打开github。说明命令行在拉取/推送代码时并没有使用vpn进行代理 第二种情况没有vpn ,这时可以去某些网站上找一些代理ip+port 解决办法:配置http代理Windows、Linux、Mac OS 中 git 命令相同: 配置socks5代理 配置http代理 注意: 命令中的

    2024年02月11日
    浏览(14)
  • 完美解决git报错fatal: unable to access ‘https://github.com/xx.git‘Failed to connect to github.com port 443

    完美解决git报错fatal: unable to access ‘https://github.com/xx.git‘Failed to connect to github.com port 443

    完美解决git报错fatal: unable to access ‘https://github.com/xx.git’ Failed to connect to github.com port 443 系统设置搜索 代理 ,然后点击编辑按钮: 打开代理服务器,端口设置为 7890 ,这个对你正常上网没有影响,可以放心设置。然后点击保存。 然后在终端输入命令: 这样就大功告成了。

    2024年02月05日
    浏览(20)
  • 解决Ubuntu18.04的git clone报错Failed to connect to github.com port 443: Connection refused

    解决Ubuntu18.04的git clone报错Failed to connect to github.com port 443: Connection refused

    (只看解决方法的可直接拉到文末!!!) 第一次在ubuntu终端使用git clone,结果报错 Failed to connect to github.com port 443: Connection refused,折腾了半天,终于成功下载(感谢这篇博客解救git clone 时Failed to connect to github.com port 443:connection timed out 怎么办-CSDN博客) 先把终端操作贴下

    2024年02月06日
    浏览(17)
  • git 报错Failed to connect to github.com port 443 after 21224 ms: Timed out 解决办法

    git 报错Failed to connect to github.com port 443 after 21224 ms: Timed out 解决办法

    在 git clone 或者 git push 时,一直报错 Failed to connect to github.com port 443 after xxx ms: Timed out 网页可以正常打开github 电脑连接VPN Windows、Linux、Mac OS 中 git 命令相同: 设置代理命令: 注意事项: 命令中的主机号(127.0.0.1)是使用的代理的主机号,如果代理软件运行在本机则填入1

    2024年02月01日
    浏览(15)
  • 如何解决:Failed to connect to github.com port 443 after 21098 ms: Timed out

    当出现: Failed to connect to github.com port 443 after 21103 ms: Couldn’t connect to server ,可能是因为开启了 系统代理 的缘故。 这时候只需要去设置力看看,开启的系统代理的port是多少? 则可以把设置git如下: 就会发现又可以愉快的git clone了,并且网速飙升~ 注意:修改后可能需要重

    2024年02月07日
    浏览(16)
  • 解决Git连接失败:Failed to connect to github.com port 443 after 21090 ms: Couldn‘t connect to server ‍

    解决Git连接失败:Failed to connect to github.com port 443 after 21090 ms: Couldn‘t connect to server ‍

    🌷🍁 博主猫头虎 带您 Go to New World.✨🍁 🦄 博客首页——猫头虎的博客🎐 🐳《面试题大全专栏》 文章图文并茂🦕生动形象🦖简单易学!欢迎大家来踩踩~🌺 🌊 《IDEA开发秘籍专栏》学会IDEA常用操作,工作效率翻倍~💐 🌊 《100天精通Golang(基础入门篇)》学会Golang语言

    2024年02月03日
    浏览(12)
  • 解决使用git时遇到Failed to connect to github.com port 443 after 21090 ms: Couldn‘t connect to server

    解决使用git时遇到Failed to connect to github.com port 443 after 21090 ms: Couldn‘t connect to server

    先试试你能直接访问GitHub: Let’s build from here · GitHub吗? 你是直接就可以访问成功还是挂梯子之后访问成功的呢? fatal: unable to access \\\'https://github.com/xxx/******.git/\\\': Failed to connect to github.com port 443 after 21090 ms: Couldn\\\'t connect to server 一般出现这种问题都是开过VPN导致的本机系统端口

    2024年02月05日
    浏览(14)
  • 解决git clone报错: Failed to connect to github.com port 443 after 21068 ms: Couldn’t connect to server

    解决git clone报错: Failed to connect to github.com port 443 after 21068 ms: Couldn’t connect to server

    不能git clone来自Github上的仓库,报端口443错误。 主要是由于Git端口与系统代理不一致 默认的端口号:127.0.0.1:7890 如果不确定可以在 网络和Internet–代理–手动设置代理–编辑 下查看 修改Git的网络设置 对于Gitee这种网站是不需要(爬的东西),因此要取消代理。可以通过下面

    2024年02月08日
    浏览(15)
  • 解决Failed to connect to github.com port 443:Connection refused

    解决Failed to connect to github.com port 443:Connection refused

    如题,在终端执行git clone时提示Failed to connect to github.com port 443:Connection regused错误 解决方案如下: 本地有连接vpn,通过在终端输入以下命令解决: git config --global http.proxy http://127.0.0.1:7890 说明:7890为本地混合配置的端口号

    2024年02月13日
    浏览(19)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包