我正在尝试使用以下命令行将代码部署到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 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 keys:add
如果它不存在的话,它会成为一个。
如果您是windows用户,这里的其他解决方案可能无法解决您的问题。
我使用的是Windows 7 64位+Git-1.7.7.1-review20111027,解决方案是将我的密钥从C:\users\user\.ssh复制到C:\Program Files(x86)\Git\.ssh。这是Git客户端在推送到heroku时查找密钥的地方。
我希望这有帮助。
检查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.
我也遇到了同样的问题;以下步骤将有助于:
首先,登录:heroku登录清除所有键:heroku键:清除删除.ssh/文件夹中本地文件夹中的所有文件(所有.pub文件和know_host)再次登录:heroku login-u将无需按键提示,因此请按照屏幕上的说明进行操作。
除了处理SSH密钥,您还可以尝试Heroku的新测试版HTTP Git支持。它只使用您的API令牌并在端口443上运行,因此无需使用SSH密钥或端口22。
要使用HTTP Git,首先确保Toolbelt已更新,并且您的凭据是最新的:
$ heroku update
$ heroku login
(这一点很重要,因为Heroku HTTP Git的认证方式与Toolbelt的其他方式略有不同)
在测试期间,通过将--httpgit标志传递给相关的heroku应用程序:create、heroku git:clone和heroku git:remote命令,可以获得HTTP。要创建新的应用程序并使用HTTP Git远程配置它,请运行以下命令:
$ heroku apps:create --http-git
要将现有应用程序从SSH更改为HTTP Git,只需从计算机上的应用程序目录运行以下命令:
$ heroku git:remote --http-git
Git remote heroku updated
有关如何为Heroku设置HTTP Git的详细信息,请查看开发中心文档。