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


当前回答

主要原因是公司最近安装的代理发生了变化,阻止了公司域以外的其他ssh连接。

我可以通过以下步骤成功连接:

仔细检查,这个问题是我所假设的 ssh -T git@github.com

它应该在一个超时中结束。

编辑本地远程URL

SSH配置——local -e

url = git@github。com: asheeshjanghu / Journal git。

to

url = https://github.com/asheeshjanghu/Journal.git

重要的一点是,在url中,你必须在2个地方改变。

从git@到https://,从github:username到github/username

最后通过git获取来验证

其他回答

我也遇到了同样的问题,但找不到有效的解决方案。我在设置本地服务器时遇到了这个问题,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工作得很好!

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

为我解决这个问题的是在密钥文件上执行ssh-add。

ssh-add C:/Path/To/Key.pem

C: / Users / User / .ssh / config:

Host sshapp
    Hostname ssh.github.com
    IdentityFile C:/Path/To/Key.pem
    Port 443

然后克隆使用:

>git clone git@sshapp:<git_user>/app.git
Cloning into 'app'...
The authenticity of host '[ssh.github.com]:443 ([140.82.121.35]:443)' can't be established.
ED25519 key fingerprint is SHA256:+DiY3wvvV6T.....vCOqU.

我也有同样的问题,但我发现的答案是不同的,认为有人可能会遇到这个问题,所以这是我的解决方案。

我必须为端口22、80、443和9418列出2个ip白名单:

192.30.252.0/22 185.199.108.0/22

如果这些IP不能工作,这可能是因为他们更新了,你可以在这个页面上找到最新的。

刷新我的网络连接对我很有效。

此外,如果你使用移动热点-重新启动移动设备是解决方案在我的情况下。