我正在尝试使用以下命令行将代码部署到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: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 remote -v
然后删除错误的heroku:
git remote rm heroku
然后添加新的
git remote add heroku git@heroku.com:sitename.git
您可以从应用程序的Heroku设置页面获取站点名称。祝你好运
只有一个命令有效:
heroku keys:add
如果它不存在的话,它会成为一个。
dmajkic的解决方案最终帮助了我:
对于Windows用户,这可能意味着:git客户端找不到您的密钥。检查c:\Users\UserName.ssh\和!环境变量HOME=c:\Users\UserName\
在Windows 7,64位上,上面的解决方案(Onur Turhan的)对我很有效,有如下细微变化
C:\Users\MyName > heroku login
输入电子邮件/密码
C:\Users\MyName >ssh-keygen -t rsa -f id_rsa
这在我的c:\Users\MyName目录(不在.ssh目录中)中生成了两个文件(id_rsa和id_rsa.pub)
heroku keys:add id_rsa.pub
git clone git@heroku.com:some-heiku-xxxx.git -o heroku
我想添加正确的“id_rsa.pub”文件是最重要的。在使用keygen生成公钥后,只需查看创建时的时间戳,即可验证是否添加了正确的密钥。