解决git clone与git push出现的若干问题:Failed to connect to github.com port 443: Timed out

简介: 解决git clone与git push出现的若干问题:Failed to connect to github.com port 443: Timed out

1. 连接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

image.png

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


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

image.png

3)测试 ping github.com


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

image.png

image.png

可以解决问题。


参考资料: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自动检测设置

image.png

尝试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地址

image.png

在hosts文件(window端的路径在:C:\Windows\System32\drivers\etc\hosts)的末尾添加:140.82.113.3 github.com


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

image.png

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


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

image.png


在hosts文件(window端的路径在:C:\Windows\System32\drivers\etc\hosts)的末尾添加:

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行代码,如下所示:

image.png

然后重新打开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账号和密码,如下所示:

image.png

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


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页面

image.png

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

image.png

cb0733fe98914eca81ad505bd68cf509.png


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

image.png

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


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

image.png

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


目录
相关文章
|
网络安全 开发工具 git
解决fatal:remote error:You can’t push to git://github.com/username/*.g
通过上述诊断与修复步骤,绝大多数的推送错误都能得到有效解决,确保您的Git工作流顺畅无阻。
573 1
|
网络协议 Shell 网络安全
ssh: connect to host github.com port 22: Connection refused
本文讨论了在使用Git命令操作GitHub时遇到的"ssh: connect to host github.com port 22: Connection refused"错误,分析了可能的原因,并提供了使用443端口或https协议作为解决方案,最终确定问题是由于DNS解析错误导致,通过修改hosts文件解决。
ssh: connect to host github.com port 22: Connection refused
|
网络安全 开发工具 数据安全/隐私保护
Win10使用Git克隆项目出现fatal: Authentication failed for异常
Windows 10系统中使用Git克隆项目时出现"fatal: Authentication failed for"异常的解决方法,主要是通过修改凭据管理器中的Git凭据密码来解决因密码过期导致的身份验证失败问题。
803 0
Win10使用Git克隆项目出现fatal: Authentication failed for异常
|
网络安全 开发工具 git
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
5388 1
|
Ubuntu 开发工具 git
ubuntu 14.04的git 错误: gnutls_handshake() failed: Handshake failed
本文提供了一个解决Ubuntu 14.04系统上使用Git时遇到的"gnutls_handshake() failed: Handshake failed"错误的脚本,通过替换git的默认加密传输库gnutls为更稳定的openssl,并指导如何编译安装新版本的git来解决问题。
694 0
|
开发工具 git
蓝易云 - 解决git clone时出现Failed to connect to 127.0.0.1 port 1573问题
希望这些信息能帮助你解决问题。如果问题仍然存在,可能需要检查你的网络设置或者联系你的网络管理员。
281 3
|
开发工具 git
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
【已解决】error: failed to push some refs to ‘git@github.com:BATdalao/Github-green.git‘
|
开发工具 git
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
出现“error: failed to push some refs to ‘https://github.com/****.git‘”,如何解决问题
2320 1
|
3月前
|
JSON Kubernetes 安全
找到啦,我们已上车,Github 27000+ star,研发团队必备开源工具项目,真丝滑!!!
Trivy 是一款高效灵活的开源安全扫描工具,支持容器镜像、文件系统、Kubernetes 等多目标扫描,具备快速、易用、集成性强等特点,适用于 DevSecOps 全流程安全检测。
172 0
|
2月前
|
人工智能 JavaScript 前端开发
Github 2024-10-28 开源项目周报 Top15
本周GitHub热门项目涵盖Svelte、Open Interpreter、PowerShell等,涉及Web开发、AI助手、自动化工具等领域,Python、JavaScript为主流语言,展现开源技术活跃生态。(239字)
443 19
下一篇
oss云网关配置