Heroku的权限被拒绝(publickey)致命:无法读取远程存储库的问题

我search了很多小时,最终寻找解决scheme,看似容易修复的问题。 这并不是说我的search没有任何结果,而是我的search出现了很多不同的解决scheme – 其中一个都没有奏效。

无论如何,我只是无法从我的Mac的Heroku存储库推,拉或取。 每一次尝试都给了我(仿佛在嘲笑我)下面的错误:

“权限被拒绝(publickey)。 致命的:无法从远程存储库读取。

我已经尝试(并重新尝试)以多种不同的方式解决它。 正如我所说,在过去的两天里,我花了很长时间来寻找答案。 以下是我尝试过的一些事情:

  • heroku键:清除后跟着heroku键:添加
  • 使用'ssh-keygen -t rsa'重新生成一个ssh密钥
  • 清除我的.ssh目录,接着是heroku密钥:清除,然后生成一个ssh密钥
  • 在heroku上删除我的应用程序并重新创build一个(幸运的是没有太多)

我可以从我的GitHub存储库中获取罚款,所以我知道这不是networking连接(pinging heroku也可以)。

作为临时解决scheme(我希望不会变成永久解决scheme),我已经login到我的Ubuntu Amazon AWS ec2实例。 从Heroku中拉出和推出完美的作品。 出于这个原因,我仍然觉得问题在于我的Mac上的ssh密钥。 这两个键都显示在我的Heroku帐户下。 关键问题结尾的电子邮件地址是?

编辑:我可以推,从GitHub罚款(但我不使用ssh,所以为什么不Heroku?

在这一点上,我愿意尝试任何事情。 谢谢!

我知道这已经回答了。 但是我想添加我的解决scheme,因为这对未来的其他人可能有帮助。

一个常见的关键错误是: Permission denied (publickey) 。 你可以通过使用keys:add来解决这个问题keys:add来通知你的新密钥的Heroku。

简而言之,请按照以下步骤操作: https : //devcenter.heroku.com/articles/keys

首先你必须创build一个密钥,如果你没有一个:

 ssh-keygen -t rsa 

其次,你必须添加Heroku的密钥:

 heroku keys:add 

我只是想分享一下,我find了自己的问题的答案。

写出我的问题使我更加清楚,并且进一步调查了我认为我的问题在哪里:ssh密钥

原来我是对的。 这个问题不是关键本身,而是我没有把它添加到本地Mac的已知ssh密钥列表中。 所以即使我的Heroku帐户上传了正确的密钥,我的Mac也无法通过validation,因为它无法在我的电脑上find这个密钥。 解决scheme?

 ssh-add ~/.ssh/id_rsa #and, to confirm it's been added to the known list of keys ssh-add -l 

我想赞扬https://help.github.com/articles/error-permission-denied-publickey是一个很好的参考。;

我有完全相同的错误(在Windows 7上),原因是不同的。 我以不同的方式解决了这个问题,所以我想我会在这里为其他人添加原因和解决scheme。

即使这个错误似乎指向了heroku,真正的错误是"Heroku can't get to the git repository" 。 我发誓我在所有的服务器上都有相同的密钥,因为我创build了它,并同时上传到另一个服务器上。

花了差不多一天的时间之后,我意识到,因为git只显示了指纹而不是真正的密钥。 我无法validation它是关键匹配我的HD或heroku上的。 我查看了已知的主机文件,并猜测它显示了每个服务器的密钥,我能够清楚地看到git和heroku公钥不匹配。

1)我删除了我的密钥文件夹中的所有文件,从github使用他们的网站的密钥,以及使用git bash和命令heroku keys:clearheroku keys:clear

2)遵循github的指示在这里生成一个新的密钥对并将公钥上传到git

3)使用git bash- heroku keys:add将相同的密钥上传到heroku。

现在git push heroku master作品。

多么噩梦,希望这对谁有帮助。

布赖恩

我遇到的问题是我只使用https作为我的GitHub帐户。 我需要确保我的GitHub帐户是为ssh访问设置的,并且GitHub和heroku都使用相同的公钥。 这些是我采取的步骤:

  1. 导航到〜/ .ssh目录并删除id_rsa和id_rsa.pub(如果它们在那里)。 我开始使用新的密钥,虽然可能没有必要。

     $ cd ~/.ssh $ rm id_rsa id_rsa.pub 
  2. 按照gitHub上的步骤生成ssh密钥
  3. login到heroku,创build一个新的网站并添加您的公钥:

     $ heroku login ... $ heroku create $ heroku keys:add $ git push heroku master 

我有相同的情况在Linux的Ubuntu的,只是修复它,似乎操作系统之间的/root/.ssh/和home /用户/ .ssh /目录之间的困惑,我做的是:

  1. 从root和home / user .shh目录中删除所有密钥。
  2. 生成一个新的密钥,确保注意创buildpath(/home/you/.ssh/id_rsa)或(/root/.ssh/id_rsa)
  3. 检查heroku键heroku keys
  4. 如果在那里heroku keys:clear清除heroku keys:clear
  5. heroku keys:add如果heroku无法find一个键,并要求生成一个正确的号码,现在heroku keys:add在这里,这意味着你有同样的问题,像我这样的添加命令heroku keys:add /root/.ssh/id_rsa.pub您将添加的path将是您在步骤2中获得的path。
  6. 试试git push heroku master现在

我在Windows 8上的方式

  1. 用ssh-keygen添加一个目录到系统的PATHvariables,通常是C:\ Program Files(x86)\ Git \ bin

  2. 打开CMD,转到C:\ Users \ Me \

  3. 生成SSH密钥ssh-keygen -t rsa

    input要保存密钥的文件(//.ssh/id_rsa):.ssh / id_rsa(将默认path更改为.ssh / somegoodname_rsa)

  4. 添encryption钥到Heroku heroku keys:add

    从列表中select一个已创build的密钥

  5. 去你的应用程序目录,写一些漂亮的代码

  6. 初始化一个git repo git init git add . git commit -m 'chore(release): v0.0.1

  7. 创buildHeroku应用程序 heroku create

  8. 部署你的应用程序git push heroku master

  9. 打开你的应用程序heroku open

有一个类似的问题,并尝试了很多东西。 最终什么对我来说,是有安装Windows上的Gnu( https://github.com/bmatzelle/gow/releases ),并确保它使用该目录中的ssh工具,而不是使用Git。 一旦安装testing(确保它在你的环境PATH,它优先于Git \斌)

 C:\Git\htest2>which ssh C:\Program Files (x86)\Gow\bin\ssh.BAT 

我用这里描述的腻子和选美: http : //rubyonrailswin.wordpress.com/2010/03/08/getting-git-to-work-on-heroku-on-windows-using-putty-plink-pageant/

一旦密钥发送到heroku(heroku键:添加c:\ Users \ Person.ssh \ id_rsa.pub),使用

 ssh -v <username>@heroku.com 

并确保你的堆栈显示Putty的使用 – 即工作堆栈:

 Looking up host "heroku.com" Connecting to 50.19.85.132 port 22 Server version: SSH-2.0-Twisted Using SSH protocol version 2 **We claim version: SSH-2.0-PuTTY_Release_0.62** Using Diffie-Hellman with standard group "group1" Doing Diffie-Hellman key exchange with hash SHA-1 Host key fingerprint is: ssh-rsa 2048 8b:48:5e:67:0e:c9:16:47:32:f2:87:0c:1f:c8:60:ad Initialised AES-256 SDCTR client->server encryption Initialised HMAC-SHA1 client->server MAC algorithm Initialised AES-256 SDCTR server->client encryption Initialised HMAC-SHA1 server->client MAC algorithm Pageant is running. Requesting keys. Pageant has 1 SSH-2 keys Using username "*--ommitted for security--*". **Trying Pageant key #0** Authenticating with public key "rsa-key-20140401" from agent Sending Pageant's response Access granted Opened channel for session Server refused to allocate pty Server refused to start a shell/command FATAL ERROR: Server refused to start a shell/command 

之前运行并失败的一个:

 C:\Git\htest2>ssh -v <username>@gmail.com@heroku.com OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007 debug1: Connecting to heroku.com [50.19.85.156] port 22. debug1: Connection established. debug1: identity file /c/Users/Person/.ssh/identity type -1 debug1: identity file /c/Users/Person/.ssh/id_rsa type 1 debug1: identity file /c/Users/Person/.ssh/id_dsa type -1 debug1: Remote protocol version 2.0, remote software version Twisted debug1: no match: Twisted debug1: Enabling compatibility mode for protocol 2.0 **debug1: Local version string SSH-2.0-OpenSSH_4.6** debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: sending SSH2_MSG_KEXDH_INIT debug1: expecting SSH2_MSG_KEXDH_REPLY debug1: Host 'heroku.com' is known and matches the RSA host key. debug1: Found key in /c/Users/Person/.ssh/known_hosts:1 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Trying private key: /c/Users/Person/.ssh/identity debug1: Offering public key: /c/Users/Person/.ssh/id_rsa debug1: Server accepts key: pkalg ssh-rsa blen 277 debug1: Trying private key: /c/Users/Person/.ssh/id_dsa debug1: No more authentication methods to try. Permission denied (publickey). 

您需要通过键入以下内容来创build新的ssh密钥 – ssh-keygen -t rsa

然后你需要添加: – heroku键:添加

那么如果你键入 – heroku打开

问题已经解决了。

无论如何,它为我工作,你可以试试看…

我得到了同样的错误,因为我有4个ssh键,所以我试着按照:

 ssh-keygen -t rsa heroku keys:add 

那么,四个选项显示:

 1) github_rsa.pub 2) id_boot2docker.pub 3) id_rsa.pub 4) sshkey.pub 

我select3),最新的一个

然后,我解决了这个错误。

我用这个方法来解决这个问题也许你可以试试看

“启用ssh-agent”

  1. 下载git

http://git-scm.com/

  1. 安装它

  2. 启用ssh-agent

C:\ Program Files \ Git \ cmd

启动的ssh-agent

I代理启用后消息消失希望这会帮助你

我遇到过同样的问题。 我试图按照所有人的说法来重置我的密钥,但是仍然没有奏效。 因为我改名了应用程序。

所以我做的是重置我的密钥,并从控制台重命名应用程序。 检查这个问题的更多信息: Heroku推送应用程序的问题

所以如此简单的解决scheme,请转到c:/Users/user_name/.ssh/并删除所有pub / private密钥对,这样heroku会为您生成密钥。

我有一个类似的heroku ssh错误,我无法解决。

作为一种解决方法,我使用了新的heroku http-gitfunction(http传输“heroku”,而不是ssh)。 详情在这里: https : //devcenter.heroku.com/articles/http-git

(短版:如果你有一个项目已经设置了标准的方式,运行heroku git:remote –http-init将“heroku”远程改为http。)

如果您没有时间修复/排除ssh问题,请快速解决。

我想添加另一个解决scheme,因为我没有在这里看到它。 我的问题是,Heroku正在链接到错误的url(因为我一直玩的url名称)。 编辑远程URL解决了我的问题:

 git remote set-url heroku <heroku-url-here>