git clone 时Failed to connect to github.com port 443:connection timed out 怎么办

第一种办法:设置全局代理

设置全局代理:

git config --global http.proxy http://127.0.0.1:1080
 
git config --global https.proxy http://127.0.0.1:1080

再次尝试,一般情况下可以正常clone。

如果遇到以下报错:

 Failed to connect to 127.0.0.1 port 1080 after 2070 ms: Connection refused

请采取第二种方法。

第二种方法:修改hosts文件(以windows系统为例)

1.打开https://github.com.ipaddress.com/ 如下图:

 记录IP地址(可能与上图有差异)!

2.打开https://fastly.net.ipaddress.com/github.global.ssl.fastly.net#ipinfo 如下图:

 

在遇到"Failed to connect to github.com port 443 after xxx ms: Timed out"错误,可能是由于网络连接问题导致的。以下是一些可能的解决办法: 1. 检查网络连接:确保你的网络连接正常,可以尝试访问其他网站来确认网络是否正常工作。 2. 检查防火墙设置:如果你使用防火墙,请确保允许git通过防火墙进行网络连接。你可以尝试禁用防火墙或者添加git到防火墙的白名单中。 3. 检查代理设置:如果你使用代理服务器进行网络连接,请确保你的git配置正确地指向了代理服务器。你可以使用以下命令检查和修改git的代理设置: ```shell # 查看当前代理设置 git config --global --get http.proxy git config --global --get https.proxy # 设置代理 git config --global http.proxy http://proxy.example.com:8888 git config --global https.proxy https://proxy.example.com:8888 # 取消代理设置 git config --global --unset http.proxy git config --global --unset https.proxy ``` 4. 尝试使用SSH协议:如果你使用的是HTTPS协议进行git操作,可以尝试使用SSH协议来连接github。首先,你需要生成SSH密钥并将公钥添加到你的github账户中。然后,你可以使用SSH URL来进行git操作,例如: ```shell git clone git@github.com:username/repo.git ``` 5. 尝试更改git的配置:有候,更改git的一些配置选项也可以解决连接超的问题。你可以尝试执行以下命令来更改git的配置: ```shell # 设置git的超间为60秒 git config --global http.lowSpeedLimit 60 git config --global http.lowSpeedTime 60 ``` 请注意,以上解决办法仅供参考,具体的解决方法可能因个人情况而异。如果问题仍然存在,请尝试联系网络管理员或者咨询github的支持团队以获取更多帮助。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值