Git 赫罗库';权限被拒绝(公钥)致命:无法从远程存储库读取';悲哀
我已经连续搜索了好几个小时,寻找一个似乎很容易解决的问题的解决方案。并不是我的搜索结果一无所获,而是我的搜索结果有这么多不同的解决方案——没有一个有效 无论如何,我根本无法从我的Mac上推、拉或从我的Heroku存储库中获取信息。每次尝试都会给我(好像在嘲笑我)以下错误: '权限被拒绝(公钥)。致命:无法从远程服务器读取 存储库。” 我试过(并再次试过)用许多不同的方法来修复它。正如我所说,过去两天我花了大量时间四处寻找答案。以下是我尝试过的一些方法:Git 赫罗库';权限被拒绝(公钥)致命:无法从远程存储库读取';悲哀,git,heroku,ssh,repository,public-key,Git,Heroku,Ssh,Repository,Public Key,我已经连续搜索了好几个小时,寻找一个似乎很容易解决的问题的解决方案。并不是我的搜索结果一无所获,而是我的搜索结果有这么多不同的解决方案——没有一个有效 无论如何,我根本无法从我的Mac上推、拉或从我的Heroku存储库中获取信息。每次尝试都会给我(好像在嘲笑我)以下错误: '权限被拒绝(公钥)。致命:无法从远程服务器读取 存储库。” 我试过(并再次试过)用许多不同的方法来修复它。正如我所说,过去两天我花了大量时间四处寻找答案。以下是我尝试过的一些方法: heroku键:清除,后跟heroku键
- heroku键:清除,后跟heroku键:添加
- 使用“ssh-keygen-t rsa”自行重新生成ssh密钥
- 清除my.ssh目录,后跟heroku键:clear,后跟生成ssh键
- 在heroku上删除我的应用程序并重新创建一个(幸运的是没有太多的应用程序)
在这一点上,我愿意尝试任何事情。谢谢 我只是想告诉大家我找到了自己问题的答案 写下我的问题让我更加清楚,我进一步调查了我认为我的问题所在:ssh密钥 结果证明我是对的。问题不在于密钥本身,而是我没有将其添加到本地Mac的已知ssh密钥列表中。因此,即使我的Heroku帐户上载了正确的密钥,我的Mac也无法对其进行身份验证,因为它无法在我的计算机上找到该密钥。解决方案是什么
ssh-add ~/.ssh/id_rsa
#and, to confirm it's been added to the known list of keys
ssh-add -l
我想赞扬你是一位很好的推荐人。我知道这个问题已经得到了回答。但我想补充一下我的解决方案,因为它可能对将来的其他人有所帮助 常见的密钥错误是:
权限被拒绝(公钥)
。您可以通过使用keys:add
通知Heroku您的新密钥来修复此问题
简言之,请遵循以下步骤:
如果没有密钥,首先必须创建密钥:
ssh-keygen -t rsa
heroku keys:add
第二步,您必须向Heroku添加密钥:
ssh-keygen -t rsa
heroku keys:add
我有完全相同的错误(在Windows7上),原因不同。我用另一种方式解决了它,所以我想我应该在这里为其他人添加原因和解决方案 尽管错误似乎指向heroku,但实际上错误是说,
“heroku无法访问git存储库”
。我发誓我在所有服务器上都有相同的密钥,因为我创建了它,并同时将它一个接一个地上传到服务器上
在花了将近一天的时间之后,我意识到,因为git只是给我看指纹,而不是真正的钥匙。我无法验证它的密钥是否与我的HD或heroku上的密钥匹配。我查看了已知主机文件,猜猜看。。。它显示了每台服务器的密钥,我能够清楚地看到git和heroku公钥不匹配
1) 我删除了我密钥文件夹中的所有文件,使用他们的网站从github中删除了密钥,使用git bash从heroku中删除了密钥,并使用命令heroku-keys:clear
2) 按照github的指示生成新的密钥对并将公钥上载到git
3) 使用gitbash-heroku键:添加
将同一密钥上载到heroku
现在,git-push-heroku-master
可以工作了
真是一场噩梦,希望这能帮助别人
Bryan我遇到的问题是,我只对我的GitHub帐户使用https。我需要确保我的GitHub帐户是为ssh访问而设置的,并且GitHub和heroku都使用相同的公钥。以下是我采取的步骤:
导航到~/.ssh目录并删除id_rsa和id_rsa.pub(如果有)。我从新钥匙开始,虽然可能没有必要
$ cd ~/.ssh
$ rm id_rsa id_rsa.pub
按照gitHub上的步骤操作
登录heroku,创建新网站并添加公钥:
$ heroku login
...
$ heroku create
$ heroku keys:add
$ git push heroku master
有类似的问题,尝试了很多东西。最终对我有效的方法是在Windows上安装Gnu(),并确保它在该目录中使用ssh工具,而不是使用Git。安装测试后,使用(确保其位于Git\bin之前的环境路径中)
我使用了油灰和选美,如下所述:
将密钥发送到heroku后(heroku密钥:add c:\Users\Person.ssh\id\u rsa.pub),使用
以前正在运行但失败的一个:
C:\Git\htest2>ssh -v <username>@gmail.com@heroku.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Person/.ssh/identity type -1
debug1: identity file /c/Users/Person/.ssh/id_rsa type 1
debug1: identity file /c/Users/Person/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
**debug1: Local version string SSH-2.0-OpenSSH_4.6**
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/Person/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/Person/.ssh/identity
debug1: Offering public key: /c/Users/Person/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Trying private key: /c/Users/Person/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
C:\Git\htest2>ssh-v@gmail。com@heroku.com
OpenSSH_4.6p1,OpenSSL 0.9.8e 2007年2月23日
debug1:连接到heroku.com[50.19.85.156]端口22。
debug1:已建立连接。
debug1:identity file/c/Users/Person/.ssh/identity-type-1
debug1:identity file/c/Users/Person/.ssh/id\u rsa类型1
debug1:identity file/c/Users/Person/.ssh/id_dsa type-1
调试1:远程协议版本2.0,远程软件版本
debug1:不匹配:扭曲
debug1:启用协议2.0的兼容模式
**debug1:本地版本字符串SSH-2.0-OpenSSH_4.6**
debug1:SSH2\u MSG\u KEXINIT已发送
debug1:SSH2\u MSG\u KEXINIT已收到
debug1:kex:server->client aes128 cbc hmac-md5无
debug1:kex:client->server aes128 cbc hmac-md5无
debug1:发送SSH2\u MSG\u KEXDH\u INIT
debug1:需要SSH2\u MSG\u KEXDH\u回复
debug1:主机'heroku.com'为kn
C:\Git\htest2>ssh -v <username>@gmail.com@heroku.com
OpenSSH_4.6p1, OpenSSL 0.9.8e 23 Feb 2007
debug1: Connecting to heroku.com [50.19.85.156] port 22.
debug1: Connection established.
debug1: identity file /c/Users/Person/.ssh/identity type -1
debug1: identity file /c/Users/Person/.ssh/id_rsa type 1
debug1: identity file /c/Users/Person/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Twisted
debug1: no match: Twisted
debug1: Enabling compatibility mode for protocol 2.0
**debug1: Local version string SSH-2.0-OpenSSH_4.6**
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Host 'heroku.com' is known and matches the RSA host key.
debug1: Found key in /c/Users/Person/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/Person/.ssh/identity
debug1: Offering public key: /c/Users/Person/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Trying private key: /c/Users/Person/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
ssh-keygen -t rsa
heroku keys:add
1) github_rsa.pub
2) id_boot2docker.pub
3) id_rsa.pub
4) sshkey.pub
git remote set-url heroku <heroku-url-here>