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


当前回答

对我来说,问题来自ISP方面。Internet服务提供商未启用端口号。所以让他们在我的网络上启用端口号,它开始工作。 仅用于测试:连接到移动热点并输入ssh -T git@bitbucket.org或git pull。 如果可以,请您的ISP启用该端口。

其他回答

我也遇到了同样的问题,但找不到有效的解决方案。我在设置本地服务器时遇到了这个问题,git无法通过我的代理网络连接,但我的工作站可以。这是我运行命令时的输出 ssh -vT git@github.com

ubuntu@server:~$ ssh -vT git@github.com
OpenSSH_7.2p2 Ubuntu-4ubuntu2.8, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /home/ubuntu/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [13.234.176.102] port 22.

因此,我尝试通过编辑配置文件~/使用通过HTTPS端口建立的SSH连接。Ssh /config但是没有效果。

Host github.com
 Hostname ssh.github.com
 Port 443

最后,我找到了这篇文章,解决并暴露了真正的问题。

# github.com
Host github.com
    Hostname ssh.github.com
    ProxyCommand nc -X connect -x <PROXY-HOST>:<PORT> %h %p
    Port 443
    ServerAliveInterval 20
    User git

这是我的配置文件,现在git通过ssh工作得很好!

建议检查网络连接或重新连接。

执行:

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

上面的答案为我提供了解决这个问题所需的信息。在我的例子中,url错误地以ssh:///开头

要检查git配置中的url是否正确,请打开git配置文件:-

git config --local -e

检查url条目。它在开始时不应该有ssh:///。

不正确的条目:

 url = ssh:///git@github.com:username/repo.git

正确的条目:

 url = git@github.com:username/repo.git

如果您的url是正确的,那么下一步将是尝试上面建议将协议更改为http的答案。

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

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