我正在尝试使用以下命令行将代码部署到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密钥,但仍然会出现此错误。
当前回答
这个问题困扰了我几天。
这可能会有所帮助。
1) 看看你现在在Heroku有什么钥匙。
$ heroku keys
=== 1 key for joe@example.com
ssh-dss AAAAB8NzaC...DVj3R4Ww== joe@workstation.local
2) 构建~/.ssh/config文件:
$ sudo vim ~/.ssh/config
使用此信息编辑
Host heroku.com
Hostname heroku.com
Port 22
IdentitiesOnly yes
IdentityFile ~/.ssh/ssh-dss # location and name of your private key
TCPKeepAlive yes
User joe@workstation.local
其他回答
我有同样的问题,因为我没有公钥,所以我做到了:
heroku keys:clear
heroku keys:add
这将生成公钥,然后工作正常
这是我的解决方案:
ssh-add ~/.ssh/my_heroku_key_rsa
当TortoiseGIT安装在我的机器上时,我遇到了这个问题。将环境变量GIT_SSH从
"c:\Program Files\TortoiseGit\bin\TortoisePlink.exe"
to
"c:\Program Files (x86)\Git\bin\ssh.exe"
使用ssh-keygen和keys完成本教程:add,它起作用了!
上面给出的答案确实有效,但我发现我需要做一些额外的步骤才能奏效。
我删除了所有id_rsa*文件,并使用本指南生成了一个新的SSH。然后,我销毁了heroku应用程序。删除了~/.heroku/credentials文件。“heroku create”命令(由于凭据文件已删除,它将提示您输入电子邮件/密码。最后键入“heroku-keys:add”,它将上载默认的~/.ssh/id_rsa.pub文件。它起作用了!好YMMV,但我真的希望这能对我有帮助,因为我一整天都在努力解决这个问题!哈哈
下面是说明如何管理ssh密钥的链接:https://devcenter.heroku.com/articles/keys#adding-heroku的关键