我正在尝试使用以下命令行将代码部署到heroku:

git push heroku master

但会出现以下错误:

Permission denied (publickey).
fatal: The remote end hung up unexpectedly

我已经上传了我的公共SSH密钥,但仍然会出现此错误。


当前回答

下面是说明如何管理ssh密钥的链接:https://devcenter.heroku.com/articles/keys#adding-heroku的关键

其他回答

听起来您的~/.ssh/authorized_keys文件设置不正确。验证:

它在正确的路径上。文件的权限为0600。~/.ssh的权限为0700。

要遵循的顺序

$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add

当执行第二条语句时,它会要求输入,只需按Enter(回车)三次,就会添加一个键。

只有一个命令有效:

heroku keys:add

如果它不存在的话,它会成为一个。

这是我的解决方案:

ssh-add ~/.ssh/my_heroku_key_rsa

我重新安装了heroku工具带,它工作了。