git GitHub“无法连接到github”没有错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17699802/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 08:47:03  来源:igfitidea点击:

GitHub "Failed connect to github" No Error

gitgithubsshgit-bash

提问by Samuel Slade

I'm pretty new to Git, but I've been using GitBash for commits, pushing and pulling for a week or two now. All was working fine, but a day or two ago when I started getting an error everytime I tried to interact with the remote repositories.

我对 Git 还是很陌生,但我一直在使用 GitBash 进行提交,推和拉已经一两个星期了。一切正常,但一两天前,我每次尝试与远程存储库交互时都开始出错。

fatal: unable to access '....': Failed connect to github.com:443; No error

致命:无法访问“....”:无法连接到 github.com:443;没有错误

I've done some Googling and come across similar StackOverflow posts and articles. From that, I've tried a number of things, including testing the SSH connection across different ports (22 and 443). It looks like port 443 (for HTTPS connections) is blocked, while port 22 seems to be open.

我已经做了一些谷歌搜索并遇到了类似的 StackOverflow 帖子和文章。从那以后,我尝试了很多事情,包括测试跨不同端口(22 和 443)的 SSH 连接。看起来端口 443(用于 HTTPS 连接)被阻止,而端口 22 似乎是开放的。

GitBash connection error

GitBash 连接错误

From what I understand of this, it looks to me like I might need to change the port Git is using from 443 to 22. I've tried changing the ~/.git/configfile and I've tried the git remote set-urlcommand to try to do this, but with no joy.

据我了解,在我看来,我可能需要将 Git 使用的端口从 443 更改为 22。我尝试更改~/.git/config文件并尝试使用git remote set-url命令来尝试执行此操作,但没有喜悦。

Any information on the original error or on how to change my Git port will be greatly appreciated.

任何有关原始错误或如何更改我的 Git 端口的信息都将不胜感激。

回答by nTraum

Any reason why you use git via HTTP? I'd suggest using SSH instead.

您通过 HTTP 使用 git 的任何原因?我建议改用 SSH。

git clone [email protected]:GreenValley/GitHubSandbox.git