【问题标题】:Suddenly can't push to heroku: "unable to negotiate key exchange method"突然无法推送到heroku:“无法协商密钥交换方法”
【发布时间】:2017-10-22 10:34:54
【问题描述】:

“git push heroku”突然失败了。 (我安装了 Node.js,我认为它可能升级了一些东西并以某种方式破坏了它。)

我已经阅读了所有类似的帖子;它没有告诉我“提供”了哪个交换,一切看起来都匹配,但通话失败,我不知所措。
我做了 heroku auth:login 成功。

ssh git@heroku.com -v 给了我以下信息:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/jeff/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for * <This line is 'Host *'>
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /Users/jeff/.ssh/id_rsa type 1
debug1: identity file /Users/jeff/.ssh/id_rsa-cert type -1
debug1: identity file /Users/jeff/.ssh/id_dsa type -1
debug1: identity file /Users/jeff/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version endosome
debug1: no match: endosome
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha2-256-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-sha2-256-etm@openssh.com none
Unable to negotiate a key exchange method

【问题讨论】:

    标签: ruby-on-rails git ssl heroku ssh


    【解决方案1】:

    今天早上我遇到了同样的问题。

    我可以避免这个问题,改变 git remote url 如下。

    来自: git@heroku.com:app-name.git

    到: https://git.heroku.com/app-name.git

    你可以使用下面的命令

    git remote rm heroku git remote add heroku https://git.heroku.com/app-name.git

    【讨论】:

    • 这修复了它!其他人可能也是对的。我认为实际的问题是我让它指向“git@heroku.bitbucket:”,它曾经可以工作。所以我最好的猜测是我有一个支持这种语法的旧 ssh,然后(意外)升级到最新版本破坏了它。无论如何,它现在可以工作了!
    【解决方案2】:

    今天早上我遇到了同样的问题。这是因为我使用的是过时的 ssh 客户端。在阅读this answer 后,我怀​​疑这是问题所在。在我的 Mac 上,我使用 homebrew,所以我能够安装 openssh。对我来说只是: brew install openssh

    那么git push heroku master就成功了。

    我对 Linux 不太熟悉,但我怀疑你可以使用像 apt-get 这样的包管理器。

    【讨论】:

    • 对。这是openssh版本。更新为 brew install openssh 修复了该问题。
    【解决方案3】:

    他们最近禁用了一些较旧的不安全密钥交换方法。正如 Kalimar 所说,您可能使用的是过时的 ssh 客户端。如果brew install openssh(或者如果您使用的是 Mac 以外的其他设备)没有修复它,或者您出于某种原因不想这样做,另一种方法是更改​​ URL 以使用 HTTPS 传输。格式为:

    https://git.heroku.com/YOUR-APP-NAME.git

    【讨论】:

      【解决方案4】:

      首先,仔细检查远程heroku是否确实是一个ssh URL

      git remote -v
      

      然后检查C:/Users/jeff/.ssh/config 的内容,其中应该有一个heroku.com 条目,以获取实际使用的私钥路径。

      如果是 https 网址,请检查您的 ~/_netrc 文件,如“Heroku CLI Authentication”。
      但对于 ssh,请参阅 Managing Your SSH Keys,以及 heroku keys:add 返回的内容。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-02-05
        • 2016-12-14
        • 1970-01-01
        相关资源
        最近更新 更多