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

Unable to negotiate a key exchange method with Mina deployment

我在使用 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)

问题是,您的本地 SSH 客户端和位于 GitHub 的远程端点无法就通用密钥交换方法达成一致。

这主要发生在您四处寻找可用的密钥交换方法集,或者您使用的是非常旧且过时的 SSH 客户端时,该客户端不支持任何仍被视为安全的方法。

有趣的是,这只发生在一些 GitHub 回购:我仍然能够从其他报告中提取。

要进行诊断,您可以设置以下环境变量以查看更多 SSH 输出:

export GIT_SSH_COMMAND="ssh -vv"

为了修复它,我在 config_ssh~/.ssh/.config 中添加了一个自定义条目,允许该主机使用更多旧算法。请注意,这应该出现在 上方 任何 Host * 部分:

# 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