我正在尝试使用以下命令行将代码部署到heroku:
git push heroku master
但会出现以下错误:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我已经上传了我的公共SSH密钥,但仍然会出现此错误。
我正在尝试使用以下命令行将代码部署到heroku:
git push heroku master
但会出现以下错误:
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
我已经上传了我的公共SSH密钥,但仍然会出现此错误。
当前回答
这是对我有用的。heroku网站没有添加到您已知的主机中。转到其他窗口-显示查看git git存储库。从那里克隆存储库。克隆后,删除刚刚创建的存储库,然后从文件菜单中导入。这样做是因为当您克隆存储库时,它不会将其添加到资源管理器视图中。现在您应该拥有git存储库和资源管理器视图。
其他回答
检查heroku的.ssh配置。转到.ssh文件夹并打开配置文件
cd ~/.ssh
subl config
“subl”用于Sublime文本,但您可以使用任何您想要的编辑器。查找“IdentityFile”行,并确保它列出了非公钥:
IdentityFile "/Users/ircmullaney/.ssh/my_ssh"
not
IdentityFile "/Users/ircmullaney/.ssh/my_ssh.pub"
这对我来说很有用。我不知道为什么我的配置文件中有公共版本,但它确实有,并且抛出了错误:
Permissions 0644 for '/Users/ircmullaney/.ssh/my_ssh.pub' are too open.
下面是说明如何管理ssh密钥的链接:https://devcenter.heroku.com/articles/keys#adding-heroku的关键
这是我的解决方案:
ssh-add ~/.ssh/my_heroku_key_rsa
推对我很有效,然后突然停了下来。
如果heroku api正在经历宕机,那么当您尝试推送时会出现此错误。
检查:
https://status.heroku.com/
在极度紧张之前。
对于那些在Windows7上尝试了上述所有方法但仍然没有成功的人,我做了以下工作:-从Git目录C:\Program Files(x86)\Git\中打开GitBash.exe(不要打开命令提示符,这不起作用)。-如上所述添加以下内容,但必须删除#
Host heroku.com
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/ssh-dss
TCPKeepAlive yes
User joe@workstation.local
现在运行gitpushherokumaster,它应该可以工作了。