我在代理下,我在相当长的一段时间内成功地推进。 现在我突然不能进入git了。 我已经设置了RSA密钥和代理,并仔细检查了它们,没有效果,git抛出了页面标题中显示的错误。


当前回答

在.ssh文件夹中 创建config文件

Host github.com
User git
Hostname ssh.github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa
Port 443

Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
IdentityFile ~/.ssh/id_rsa

其他回答

执行:

nc -v -z <git-repository> <port>

你的输出应该是这样的:

"Connection to <git-repository> <port> port [tcp/*] succeeded!"

如果你得到:

connect to <git-repository> <port> (tcp) failed: Connection timed out

您需要编辑~/。ssh / config文件。添加如下内容:

Host example.com
Port 1234

我在我的服务器上有这个问题,它是用常规IP和故障转移IP设置的。此时,故障转移IP没有指向服务器。我必须从/etc/netplan/01-netcfg.yaml中的服务器配置中删除故障转移IP。将故障转移IP指向该服务器也可能解决了这个问题。

快速解决方法:尝试切换到不同的网络

我在热点(3/4G连接)时遇到了这个问题。切换到不同的连接(WiFi)解决了这个问题,但这只是一个变通办法——我没有机会深入了解问题的根源,所以其他答案可能更有趣,可以确定潜在的问题

重启电脑帮我解决了这个问题。 Git版本:2.27.0.windows.1 操作系统版本:Windows 10

好试试这个ssh -T -p 443 git@ssh.github.com而不是ssh -T git@github.com