我正在尝试使用以下命令行将代码部署到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
其他回答
听起来您的~/.ssh/authorized_keys文件设置不正确。验证:
它在正确的路径上。文件的权限为0600。~/.ssh的权限为0700。
这是我的解决方案:
ssh-add ~/.ssh/my_heroku_key_rsa
我重新安装了heroku工具带,它工作了。
推送时使用
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
我有同样的问题,因为我没有公钥,所以我做到了:
heroku keys:clear
heroku keys:add
这将生成公钥,然后工作正常