无法将git repo推送到Heroku,尽管有效的SSH密钥 [英] Unable to push git repo to Heroku, despite valid SSH keys

查看:119
本文介绍了无法将git repo推送到Heroku,尽管有效的SSH密钥的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在另一台电脑上浏览了整个heroku安装文档,所有的工作都完美无缺。



当我运行时:



<$ p $不知道为什么这个不工作,但我需要它。 p> > git push -v heroku master

推送到git@heroku.com:lit-tor-7969.git
权限被拒绝(publickey)。
致命:远程终端意外挂起

Stack上的所有解决方案都涉及重置SSH密钥,我相信SSH密钥是好的。我在Mac OSX上运行:

  heroku键:清除
heroku键:添加

所以在我看来,git使用/Users/bishopz/.ssh键而不是手动在内部生成的键储存库文件夹。除了下面的答案外,这篇文章似乎提供了很多见解:
无法推送到Heroku,因为密钥指纹 我试图彻底删除.ssh目录。我跑了

  heroku键:清除
ssh-add -D#删除所有ssh身份
ssh -keygen -t rsa -Cemail@gmail.com-f〜/ .ssh / id_rsa_heroku
ssh-add〜/ .ssh / id_rsa_heroku
heroku keys:add〜/ .ssh / id_rsa_heroku。 pub
git push heroku master

现在得到:

 !带有指纹27:5f:64:4e:2e:f0:41:5b:62:a9:95:d2:02:df:27:85的密钥无权访问lit-tor-7969。 
致命:远程终端意外挂断

$ b的响应
$ b

  ssh -vvv git@heroku.com 

现在是:

  debug1:主机'heroku.com'是已知的并且与RSA主机密钥匹配。 
debug1:找到密钥在/Users/bishopz/.ssh/known_hosts:1
debug1:ssh_rsa_verify:签名正确
debug1:提供RSA公钥:/Users/bishopz/.ssh/id_rsa_heroku
debug1:服务器接受密钥:pkalg ssh-rsa blen 279
debug1:身份验证成功(publickey)。
通过heroku.com验证([50.19.85.132]:22)。

任何帮助表示赞赏,如果有人可以发布对我有用的答案,我将开始新的赏金。

解决方案

好的,我能解决它。其中几个答案很有帮助。似乎发生了两件事。

首先,根据这篇文章 SSH密钥已经变得困惑。这是通过删除.ssh目录解决的(当然这会删除所有使用.ssh的东西的凭证,但可以在以后重新创建):

  heroku keys:清除
ssh-add -D#删除所有ssh身份
ssh-keygen -t rsa -Cemail@gmail.com-f〜/。 ssh / id_rsa_heroku
ssh-add〜/ .ssh / id_rsa_heroku
heroku keys:add〜/ .ssh / id_rsa_heroku.pub

其次,根据这篇文章在对ssh密钥进行故障排除的过程中,应用程序名称发生了某种变化。应用程序名称必须在/repository_folder/.git/config中手动编辑



要获取正确的应用程序名称,我登录到web上的heroku.com,然后更新



  [remoteheroku] 


url = git@heroku.com:my_new_app_name.git
fetch = + refs / heads / *:refs / remotes / heroku / *

感谢所有发布的建议!我很高兴终于能够开始一个新的应用程序!



- 更新 -



每次重新启动计算机时,我都必须重新运行此命令。我可以将它添加到我的.profile或其他内容中,但认为它值得一注。


There are lots of stack articles citing the same error message as I am getting.

I went through the entire heroku setup doc on another computer and everything worked perfectly. Not sure why this one is not working, but I need it to.

When I run:

> git push -v heroku master

Pushing to git@heroku.com:lit-tor-7969.git
Permission denied (publickey).
fatal: The remote end hung up unexpectedly

All of the solutions on Stack involve reseting the ssh keys, and I believe the ssh keys are fine. I am on Mac OSX and have run:

heroku keys:clear
heroku keys:add

So it looks to me like the git is using /Users/bishopz/.ssh keys rather than the keys I generated manually inside the repository folder.

In addition to the answers below, this article seems to be providing a lot of insight: Cannot push to Heroku because key fingerprint

I tried completely removing the .ssh directory. I ran

heroku keys:clear
ssh-add -D #to remove all ssh identities
ssh-keygen -t rsa -C "email@gmail.com" -f  ~/.ssh/id_rsa_heroku
ssh-add ~/.ssh/id_rsa_heroku
heroku keys:add ~/.ssh/id_rsa_heroku.pub
git push heroku master

and now get:

!  Your key with fingerprint 27:5f:64:4e:2e:f0:41:5b:62:a9:95:d2:02:df:27:85 is not authorized to access lit-tor-7969.
fatal: The remote end hung up unexpectedly

The response to

ssh -vvv git@heroku.com

is now:

debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /Users/bishopz/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: Offering RSA public key: /Users/bishopz/.ssh/id_rsa_heroku
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to heroku.com ([50.19.85.132]:22).

Any help appreciated, I'll start a new bounty if someone can post an answer that works for me.

解决方案

Okay, I was able to solve it. Several of these answers were helpful. It seem that two things had happened.

First, based on this article the ssh keys had gotten confused. This was resolved by deleting the .ssh directory (of course this removed all the credentials for other things that use .ssh, but those can be recreated later):

heroku keys:clear
ssh-add -D #to remove all ssh identities
ssh-keygen -t rsa -C "email@gmail.com" -f  ~/.ssh/id_rsa_heroku
ssh-add ~/.ssh/id_rsa_heroku
heroku keys:add ~/.ssh/id_rsa_heroku.pub    

Secondly, based on an answer to this article the app name had somehow changed during the process of troubleshooting the ssh keys. The app name had to be manually edited in /repository_folder/.git/config

To get the correct app name I logged into heroku.com on the web and then updated the config file:

it's contains

[remote "heroku"]
    url = git@heroku.com:my_new_app_name.git
    fetch = +refs/heads/*:refs/remotes/heroku/*

Thanks to all that posted suggestions! I am so happy to finally be on my way to a new app!

--UPDATE--

I have to rerun this command every time I reboot the computer. I can add it my .profile or whatever, but thought it was worth a note.

这篇关于无法将git repo推送到Heroku,尽管有效的SSH密钥的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆