2017-10-19 120 views
4

“git push heroku”突然失败。 (我安装了Node.js,我认为它可能已经升级了一些东西并以某种方式打破了这一点。)突然间无法推送到heroku:“无法协商密钥交换方法”

我已阅读所有类似帖子;它并没有告诉我哪个交易是'提供'的,而且一切都看起来像是匹配的,但是通话失败了,我不知所措。
我做了heroku认证:登录成功。

ssh [email protected] -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 [email protected] none 
debug1: kex: client->server aes128-ctr [email protected] none 
Unable to negotiate a key exchange method 

回答

8

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

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

来自: [email protected]: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

+0

这定了!其他人也许是对的。我认为实际的问题是我已经指向过去工作的“[email protected]:”。所以我最好的猜测是我有一个支持这种语法的旧ssh,然后(意外)升级到最新版本就破坏了它。无论如何,它现在的作品! – user3407688

0

首先,仔细检查,如果远程Heroku的确实是一个SSH URL

git remote -v 

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

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

4

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

然后git push heroku master成功。

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

+0

对。这是openssh版本。用'brew install openssh'更新修复了这个问题。 –

0

他们最近禁用了一些旧的不安全密钥交换方法。正如Kalimar所说,你可能正在使用过时的ssh客户端。如果brew install openssh(或者如果您使用的是Mac以外的版本,则是等同的)不能解决问题,或者您不想因为任何原因这样做,另一种方法是将URL更改为使用HTTPS传输。格式为:

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