我正在尝试使用以下命令行将代码部署到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密钥,但仍然会出现此错误。
当前回答
推送时使用
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
其他回答
dmajkic的解决方案最终帮助了我:
对于Windows用户,这可能意味着:git客户端找不到您的密钥。检查c:\Users\UserName.ssh\和!环境变量HOME=c:\Users\UserName\
听起来您的~/.ssh/authorized_keys文件设置不正确。验证:
它在正确的路径上。文件的权限为0600。~/.ssh的权限为0700。
要遵循的顺序
$ heroku login
$ ssh-keygen -t rsa
$ heroku keys:add
当执行第二条语句时,它会要求输入,只需按Enter(回车)三次,就会添加一个键。
尝试修复磁盘实用程序(Mac OS X)中的权限。帮助了我
如果您已上载密钥,请尝试删除密钥,然后重新上载它有一把新钥匙。
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
这应该奏效。