解决git clone -Failed to connect to github.com port 443: Timed out

1 原文:https://developer.aliyun.com/article/1077240

. 连接github失败问题汇总:Failed to connect to github.com port 443: Timed out



1.1 解决ping不通github.com的问题

可以跳过直接看章节4,一个统一处理的方法


1)查询github的IP的地址


在以下链接找到网页显示github的ip地址http://github.global.ssl.fastly.net.ipaddress.com/,如图所示,我这里查到的地址是199.232.69.194

2)在hosts文件末尾添加地址


hosts文件的路径在:C:WindowsSystem32driversetchosts,在文件的末尾添加:199.232.69.194 github.com 即可,如下所示

3)测试 ping github.com


在cmd环境与git bash环境均可以ping通

可以解决问题。


参考资料:Ping github 请求超时解决方案


1.2 连接出错问题:OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

可以跳过直接看章节4,一个统一处理的方法


完整错误显示:


fatal: unable to access ‘https://github.com/Clichong/testgit.git/’:

OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443


这里查找过一些资资料:


尝试1:关闭vpn


尝试2:关闭window自动检测设置

尝试3:使用git命令关闭网络代理再重新打开命令行窗口


1)命令行输入以下


git config --global http.sslVerifyfalse
git config --global --unset http.proxy
git config --global --unset https.proxy
git config --global http.sslBackend "openssl"


2)重启命令行窗口,重新git push


参考资料:github 443 错误 OpenSSL SSL_connect: SSL_ERROR_SYSCALL 或者LibreSSL 终极解决办法


但是以上尝试全部失败,不知道是否对你们适用。


1.3 链接返回错误:The requested URL returned error: 500

可以跳过直接看章节4,一个统一处理的方法


完整错误显示:


fatal: unable to access ‘https://github.com/Clichong/nanodet/’: The

requested URL returned error: 500


1.4 访问超时问题:Failed to connect to github.com port 443: Timed out

对于这里标题出现的全部问题,


1)Failed to connect to github.com port 443: Timed out

2)The requested URL returned error: 500

3)OpenSSL SSL_connect: SSL_ERROR_SYSCALL in connection to github.com:443

4)ping不通github地址


我觉得都可以通过以下的办法解决:


  1. 打开 https://github.com.ipaddress.com/并复制记录红框所示ip地址

在hosts文件(window端的路径在:C:WindowsSystem32driversetchosts)的末尾添加:140.82.113.3 github.com


  1. 打开https://ipaddress.com/website/github.global.ssl.fastly.net#ipinfo并复制所示ip地址

在hosts文件(window端的路径在:C:WindowsSystem32driversetchosts)的末尾添加:199.232.69.194 github.global.ssl.fastly.net


  1. 打开https://github.com.ipaddress.com/assets-cdn.github.com并把四个ip都记下来


在hosts文件(window端的路径在:C:WindowsSystem32driversetchosts)的末尾添加:

185.199.108.153 assets-cdn.github.com
185.199.109.153 assets-cdn.github.com
185.199.110.153 assets-cdn.github.com
185.199.111.153 assets-cdn.github.com


最后,hosts文件最后添加了6行代码,如下所示:

然后重新打开bash,重新git push即可,不过这里我碰到了一个问题,见下面的第二节:Logon failed, use ctrl+c to cancel basic credential prompt


参考资料:Git 报错:Failed to connect to github.com port 443: Timed out 解决办法


ps:这里有些网址是询问朋友得到的,和参考资料的部分网址可能不太一样,参考资料只是提供了参考。


2. 用户登录失败:Logon failed, use ctrl+c to cancel basic credential prompt.


在以上操作中,我已经可以正常的git clone了(有一个插曲就是得开手机热点使用,通过校园网连接会失败,毕竟校友网对github访问有限制),但是在进行git push尝试的时候仍然出现了错误。


这里弹出了以下窗口让我登录github账号和密码,如下所示:

我正常登录但是登录失败;这里还会有让你进行二次登录的操作,我同样正常输入,结果还是失败,完整的错误信息如下:


Logon failed, use ctrl+c to cancel basic credential prompt. remote:

Support for password authentication was removed on August 13, 2021.

Please use a personal access token instead. remote: Please see

https://github.blog/2020-12-15-token-authentication-requirements-for-git-operations/

for more information. fatal: Authentication failed for

‘https://github.com/Clichong/testgit.git/’


根据参考资料,这里我可以正常的解决,这里的解决办法是:


1)在网页上登陆你自己的githup账号,点击右上角头像–> setting --> Developer settings --> Personal access tokens页面

2)点击新建 genrate new token,在note中随便填写,然后根据以下进行权限勾选


3)新建完成,页面已经有一个新的token,这个页面先不要动,或者先复制出来,页面刷新后这个token就看不见了

回到git bash 继续提交,在githup登陆弹出框中输入账号密码,第一次输入的是你githup的账号密码,第二次弹出后输入git账号,密码换成刚刚生成的token。如果两次错误,会提示你在git bash中输入账号,之后会弹出一个密码框,这个也是输入token。


总之,账号还是输入你自己的git账号,密码,第二次之后输入token,之后重新push就成功了。

参考资料:Logon failed, use ctrl+c to cancel basic credential prompt.

展开阅读全文

页面更新:2024-05-20

标签:末尾   参考资料   路径   账号   窗口   错误   密码   页面   地址   文件

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top