ruby-on-rails - 无法与 Mina 部署协商 key 交换方法

标签 ruby-on-rails git ubuntu deployment ssh

我在使用 Mina 进行部署时遇到这样的消息,但不确定为什么 Git 无法提取 repo。

由于 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 上的远程端点无法就通用 key 交换方法达成一致。

这主要发生在您使用一组可用的 key 交换方法时,或者您使用的是非常旧且过时的 SSH 客户端,它不支持任何仍被认为是安全的方法。

有趣的是,这只发生在一些 GitHub Repos 上:我仍然可以从其他报告中提取。

要进行诊断,您可以设置以下环境变量以查看更多 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

关于ruby-on-rails - 无法与 Mina 部署协商 key 交换方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33410640/

相关文章:

ruby-on-rails - Rails : scaffold. 为模型创建管理 Controller

ruby-on-rails - rails 3 : alias_method_chain still used?

ruby-on-rails - 我应该如何处理 ruby 中的这种关系?

git - 无法推送到 git 存储库 - 权限被拒绝

git - 在git中,如何将提交加载到工作树而不是索引中

MySQL/MariaDB 在 1 分 42 秒后关闭

windows - 我是否需要同时为 Windows 10 和 WSL 安装 Git?

ruby-on-rails - 如何在 Devise 中手动创建新用户和用户 session ?

git - 我怎样才能重新启动 git bash?

ubuntu - Ubuntu 13.04 在/var/log/auth.log 中查询