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