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

一、问题描述:Failed to connect to github.com port 443: Connection refused问题解决

当下载Nacos时报错如下(可能你是其他与github交互的操作报错,pull或者push等等,但原因都一样):

Cloning into 'nacos'...
fatal: unable to access 'https://github.com/alibaba/nacos.git/':
Failed to connect to github.com port 443: Connection refused

二、解决方法一:排查代理问题

1、尝试重置代理或者取消代理的方式

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

如果没效果,接着往下试。

2、添加全局代理

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

如果以上问题还未得到解决,可能不是代理的问题,或许是DNS解析,再采用接下来的方法尝试。

三、解决方法二:排查DNS解析问题

提示:在DNS解析前先会尝试走hosts然后在找不到的的情况下再DNS解析,修改hosts文件域名解析就会先走hosts中的ip和域名的映射关系。

我们可以修改hosts文件,修改ip地址和域名的映射关系,步骤如下:

1、第一步:查找github.com对应的IP

首先通过网址ipaddress.com搜索框输入github.com,查找github.com对应的IP地址:

在这里插入图片描述
结果页面拉到最下边会看到如下信息:140.82.113.3 即查到的github.com的IP地址:

在这里插入图片描述

2、第二步:修改hosts文件

其次找到本机的hosts文件,将查询到的GitHub IP地址内容140.82.113.3 github.com 追加进hosts文件:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1	localhost
255.255.255.255	broadcasthost
::1             localhost
199.232.4.133 raw.githubusercontent.com
# Added by Docker Desktop
# To allow the same kube context to work on the host and the container:
127.0.0.1 kubernetes.docker.internal
# End of section
127.0.0.1 eureka7002.com
127.0.0.1 eureka7001.com
10.10.255.120 hbygj-admin.hrhbbx.com 

140.82.113.3 github.com

提示:
Windows大概在C:\Windows\System32\drivers\etc下
Mac在/etc下,打开访达后,在键盘上按Shift+Command+G组合键,在窗口中输入/etc/hosts ,即可到达hosts文件的所在位置

配置好后,再去重新操作,成功解决。


如果解决了你的问题,可以支持一下哦。
在这里插入图片描述

  • 27
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 3
    评论
回答: 当出现"Failed to connect to github.com port 443: Connection refused"错误时,可能有几种解决方法。首先,可以尝试关闭代理,因为代理工具可能会导致连接问题。可以尝试重置或取消代理设置来解决问题。\[1\] 另外,还可以通过修改hosts文件来解决问题。可以使用IP查询工具来获取GitHub最新的真实地址,并将其添加到hosts文件中。这样可以确保连接到正确的GitHub地址。\[2\] 此外,如果出现"gnutls_handshake() failed: Error in the pull function"错误,可以尝试将地址中的"https"改为"git"。如果在git clone子模块时遇到此问题,可以打开.gitmodules文件,并将submodule中的url进行相应的修改。\[2\] 最后,如果电脑开启了代理,例如翻墙软件等,也可能导致连接问题。可以尝试取消全局代理来解决问题。可以使用以下命令取消全局代理设置:git config --global --unset http.proxy和git config --global --unset https.proxy。\[3\] #### 引用[.reference_title] - *1* [Failed to connect to github.com port 443: Connection refused问题解决](https://blog.csdn.net/weixin_44442186/article/details/124979085)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *2* [ubuntu18.04 git clone:Failed to connect to github.com port 443: Connection refused](https://blog.csdn.net/qq_38204686/article/details/123444765)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [github 报错 Failed to connect to github.com port 443:connection timed out(最全解决办法)](https://blog.csdn.net/qq_49244747/article/details/131457129)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down1,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一只IT攻城狮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值