git找不到正确的ssh

问题描述 投票:9回答:5

当我尝试使用git连接时,我看到了这个错误

$ git clone [email protected]:MyCompany/eagle.git --verbose                                         
Cloning into 'eagle'...                                                                        
FATAL ERROR: Couldn't agree a key exchange algorithm (available: [email protected],ecdh-sh
a2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521)                                                   
fatal: Could not read from remote repository.                                                        

Please make sure you have the correct access rights                                                  
and the repository exists.

我设置所有键等连接工作正常,因为当我做ssh -v [email protected]连接成功。

我该怎么做才能理解出了什么问题以及应该纠正什么?

谢谢,

git github ssh ssh-keys
5个回答
5
投票

如果ssh -T [email protected]给你:

Hi <name>! You've successfully authenticated, but GitHub
does not provide shell access.

消息,这意味着您的ssh设置正常。如果你得到一个:

FATAL ERROR: Couldn't agree a key exchange algorithm ...

这意味着你的ssh设置无法正常工作。显然这里存在矛盾,最可能的罪魁祸首是你安装了两个不同的ssh命令:一个是你正在使用的,哪个是有效的,另一个是Git正在使用的,但是没有。

This answerGit with SSH on Windows有很多赞成票。我避免使用Windows,因此我不知道这是否会有所帮助。 (我甚至不知道你是否在Windows上,因为你还没有提到它。)

请注意Git version 2.3.0 added GIT_SSH_COMMANDGit version 2.10.0 added core.sshCommand to set a value for GIT_SSH_COMMAND。从那以后,Git version 2.13.0 learned some new tricks for dealing with issues tied to variations of ssh that demand different option letters.在所有情况下,确定哪个ssh Git正在运行是很重要的,并确保它运行一个实际工作的。有关所有选项变量及其功能的说明,请参阅the top level Git documentation。这里的链接转到可能与您自己的Git版本不匹配的网页,因此如果您的Git很老,请考虑运行git --help git来读取该版本。


10
投票

对我而言,这种情况正在发生,因为:

  1. 我让Git配置使用PuTTY(即GIT_SSH=C:\Program Files\PuTTY\plink.exe
  2. 我正在运行旧版PuTTY(例如0.63)
  3. GitHub最近有removed weak cryptography standards

我卸载了PuTTY 0.63和downloaded并安装了最新版本的PuTTY(此时为0.70),这解决了我的问题。


4
投票

问题出在GIT_SSH上。这个变量之前是由putty设定的。我删除了这个env变量,问题已经解决了


1
投票

这可能与GitHub qazxsw poi有关。这发生在2018年2月22日左右。


0
投票

我一直在使用SourceTree,然后是putty,然后是open-ssh。实际上,在检查removing weak crypto env变量值时,使用了与SourceTree一起安装的putty。要使用open-ssh,需要删除此env变量。 (不使用腻子)

对于新手我使用这个片段用open-ssh“登录”到github:GIT_SSH

编辑:没关系我昨天成功连接,但现在它停止工作...同时使用选美与腻子。

© www.soinside.com 2019 - 2024. All rights reserved.