我在代理下,我在相当长的一段时间内成功地推进。 现在我突然不能进入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工作得很好!

将repo url从ssh更改为https对我来说没有多大意义。因为我更喜欢ssh而不是https,因为我不想放弃一些额外的好处。以上答案都很好,也很准确。如果你在GitLab遇到这个问题,请去他们的官方文档页面,并像那样修改你的配置文件。

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

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

在.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

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