我正在尝试使用以下命令行将代码部署到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密钥,但仍然会出现此错误。
当前回答
我必须这样做:
$ ssh-keygen -t rsa
$ heroku keys:add
然后它奏效了:
$ git push heroku master
其他回答
这是我的解决方案:
ssh-add ~/.ssh/my_heroku_key_rsa
如果您已上载密钥,请尝试删除密钥,然后重新上载它有一把新钥匙。
heroku keys:remove //removes the existing key
ssh-keygen -t rsa //generates a new key in ~/.ssh folder
heroku keys:add //uploads the new key, if no arguments r passed then the key generated
//in default directroy i.e., ~/.ssh/id_rsa is uploaded
git push heroku
这应该奏效。
这是对我有用的。heroku网站没有添加到您已知的主机中。转到其他窗口-显示查看git git存储库。从那里克隆存储库。克隆后,删除刚刚创建的存储库,然后从文件菜单中导入。这样做是因为当您克隆存储库时,它不会将其添加到资源管理器视图中。现在您应该拥有git存储库和资源管理器视图。
当TortoiseGIT安装在我的机器上时,我遇到了这个问题。将环境变量GIT_SSH从
"c:\Program Files\TortoiseGit\bin\TortoisePlink.exe"
to
"c:\Program Files (x86)\Git\bin\ssh.exe"
使用ssh-keygen和keys完成本教程:add,它起作用了!
如果您是windows用户,这里的其他解决方案可能无法解决您的问题。
我使用的是Windows 7 64位+Git-1.7.7.1-review20111027,解决方案是将我的密钥从C:\users\user\.ssh复制到C:\Program Files(x86)\Git\.ssh。这是Git客户端在推送到heroku时查找密钥的地方。
我希望这有帮助。