Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/git/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Git 不接受Heroku密钥_Git_Heroku_Ssh - Fatal编程技术网

Git 不接受Heroku密钥

Git 不接受Heroku密钥,git,heroku,ssh,Git,Heroku,Ssh,我试图推到heroku,但得到了一个拒绝许可的错误。我已经关注了这些地点的文章: 但这些都不起作用 以下是shell的输出,以显示我正在尝试执行的操作: [root]# heroku keys You have no keys. [root]# heroku login Enter your Heroku credentials. Email: myemail@domain.com Password (typing will be hidden): Found the

我试图推到heroku,但得到了一个拒绝许可的错误。我已经关注了这些地点的文章:

但这些都不起作用

以下是shell的输出,以显示我正在尝试执行的操作:

[root]# heroku keys
  You have no keys.
[root]# heroku login
  Enter your Heroku credentials.
  Email: myemail@domain.com
  Password (typing will be hidden): 
  Found the following SSH public keys:
  1) github.pub
  2) heroku.pub
  Which would you like to use with your Heroku account? 2
  Uploading SSH public key /root/.ssh/heroku.pub... done
  Authentication successful.
[root]# git init
  Reinitialized existing Git repository in /.git/
[root]# git push heroku master
  Permission denied (publickey).
  fatal: The remote end hung up unexpectedly

编辑:这是为CentOS服务器设计的。

我想出来了。。我想你实际上需要使用id_rsa而不是定制的。。我一运行ssh-keygen-t rsa-f id\u rsa它就工作了。如图所示。

对于未来的访问者,我添加了另一个答案(在上面的@redhotvengeance评论之后),它不要求您对heroku密钥使用id\u rsa。 以下一系列命令启动ssh代理并添加heroku密钥,以便推送成功:

ssh-agent
ssh-add ~/.ssh/my_heroku_key
# now it should work
git push heroku master

而且它工作得很好。

您使用的是Mac吗?您使用的是像
ssh-agent
这样的密钥管理器吗?我在Mac上,但这是在CentOS服务器上。即使如此,是否仍在使用
ssh-agent