代码之家  ›  专栏  ›  技术社区  ›  Bill Lumbert

git找不到正确的ssh

  •  14
  • Bill Lumbert  · 技术社区  · 7 年前

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

    $ git clone git@github.com:MyCompany/eagle.git --verbose                                         
    Cloning into 'eagle'...                                                                        
    FATAL ERROR: Couldn't agree a key exchange algorithm (available: curve25519-sha256@libssh.org,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 git@github.com 连接成功。

    我该怎么做才能理解哪里出了问题,应该纠正什么?

    谢谢

    5 回复  |  直到 7 年前
        1
  •  12
  •   mfisherca    7 年前

    对我来说,这是因为:

    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 并安装了最新版本的腻子(目前为0.70),这为我解决了问题。

        2
  •  7
  •   torek    7 年前

    如果 ssh -T git@github.com 为您提供:

    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 answer Git with SSH on Windows 有很多赞成票。我避开窗户,所以我不知道这是否有帮助。(我甚至不知道你是否在Windows上,因为你没有提到。)

    请注意 Git version 2.3.0 added GIT_SSH_COMMAND Git 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正在运行非常重要,并确保它运行的是一个真正有效的ssh-Git。看见 the top level Git documentation 有关所有选项变量及其作用的说明。此处的链接指向的网页可能与您自己的Git版本不匹配,因此请考虑运行 git --help git 如果您的Git非常旧,请阅读该版本。

        3
  •  4
  •   Ambroise Rabier    6 年前

    问题出在GIT\u SSH中。此变量之前已由putty设置。 我删除了这个env变量,问题已经解决了

        4
  •  1
  •   Paul Vincent Craven    7 年前

    这可能与GitHub有关 removing weak crypto . 这大约发生在2018年2月22日。

        5
  •  0
  •   Ambroise Rabier    6 年前

    我一直在使用SourceTree,然后是putty,然后是open ssh。实际上做得很糟,检查时使用了SourceTree安装的putty GIT_SSH env变量值。要使用open ssh,需要删除此env变量。(不使用腻子so)

    对于新手,我使用此代码段使用open ssh“登录”到github: eval $(ssh-agent -s) && ssh-add ~/.ssh/mySHHKey

    编辑:没关系,我昨天成功连接,但现在它停止工作了。。。同时用油灰进行选美。