无法与Mina部署协商密钥交换方法

时间:2015-10-29 09:41:40

标签: ruby-on-rails git ubuntu deployment ssh

我在与Mina一起部署时遇到这样的消息,但不确定为什么Git无法撤回回购。

由于Unable to negotiate a key exchange method消息,我尝试切换sshd_config,但仍然无法解决问题。谢谢你的帮助。

   -----> Creating a temporary build path
          $ touch "deploy.lock"
          $ mkdir -p "$build_path"
          $ cd "$build_path"

   -----> Cloning the Git repository
          $ git clone "git@github.com:repo/project.git" "/home/deploy/project/scm" --bare
          Cloning into bare repository '/home/deploy/project/scm'...
          Unable to negotiate a key exchange method
          fatal: Could not read from remote repository.

          Please make sure you have the correct access rights
          and the repository exists.
    !     ERROR: Deploy failed.

   -----> Cleaning up build
          $ rm -rf "$build_path"
          Unlinking current
          $ rm -f "deploy.lock"
          OK

    !     Command failed.
          Failed with status 1 (19)

1 个答案:

答案 0 :(得分:2)

The issue is, that your local SSH client and the remote endpoint at GitHub are unable to agree on a common key exchange method.

This will mostly occur when you poked around with the set of available Key exchange methods or you are using a very old & outdated SSH client which does not support any method which is still regarded as safe.

Interestingly this only occurs on some GitHub Repos: I'm still able to pull from other reports.

To diagnose you can set the following environment variable to see more of the SSH output:

export GIT_SSH_COMMAND="ssh -vv"

To fix it, I added a custom entry in my config_ssh or ~/.ssh/.config allowing more legacy algorithms for that host. Please note this should appear above any Host * section:

# Github needs diffie-hellman-group-exchange-sha1 some of the 
# time but not always.
Host github.com
    KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1