我正在尝试使用以下命令行将代码部署到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密钥,但仍然会出现此错误。
当前回答
我花了三天的时间尝试各种可能的组合,试图让它发挥作用——我最终尝试了制作DSA密钥,结果成功了。
如果不适合您,请尝试DSA而不是RSA。
(我使用的是Ubuntu 11.10、ruby 1.8.7、heroku 2.15.1)
其他回答
如果您是windows用户,这里的其他解决方案可能无法解决您的问题。
我使用的是Windows 7 64位+Git-1.7.7.1-review20111027,解决方案是将我的密钥从C:\users\user\.ssh复制到C:\Program Files(x86)\Git\.ssh。这是Git客户端在推送到heroku时查找密钥的地方。
我希望这有帮助。
这个问题困扰了我几天。
这可能会有所帮助。
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
推送时使用
git push heroku production:master
使用主目录~/.ssh/id_rsa下的公钥
要解决此问题
您应该以其他用户身份登录,可能是root用户
sudo su
然后通过发出以下命令重新开始
heroku keys:clear //removes existing keys
ssh-keygen -t rsa //generates a new key in ~/.ssh folder (set a password)
heroku keys:add //uploads the new key, ~/.ssh/id_rsa is uploaded
git push heroku production:master
除了处理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的详细信息,请查看开发中心文档。
我也有同样的问题,下面的步骤对我有效,
->heroku login
abc@gmail.com密码(&P)
->cd C:\Users\yourusername\.ssh (OR for cygwin shell ->cd ~/.ssh)
->ssh密钥生成-t rsa-f id_rsa
如果询问任何密码,请不要使用空白,填写密码,但不要忘记。
生成密钥后,您需要添加它,如下所示
$ ssh-add
给heroku
->heroku keys:add "id_rsa.pub"
将目录更改为工作区,然后
->git clone git@heroku.com:stark-dawn-1234.git -o heroku
使用上面设置的密码短语。
实际上,我也删除了下面的文件,但不确定它们是imp,
C: \Users\yourusername.heroku\credientals和C:\Users\yourusername.ssh\known_hosts