2017-10-19 62 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