Github权限被拒绝:ssh add agent没有身份 [英] Github permission denied: ssh add agent has no identities

查看:1331
本文介绍了Github权限被拒绝:ssh add agent没有身份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我第一次访问github,但我没有经验使用控制台。我在Macbook上(使用Bash)。当我尝试访问github时,我得到这个:

  git clone git@github.com:dhulihan / league-of-legends -data-scraper.git 
克隆到'英雄联盟 - 数据刮板'中...
权限被拒绝(publickey)。
致命:无法从远程存储库读取。

请确保您拥有正确的访问权限
并存在存储库。

我试着按照Github页面上关于权限被拒绝
当我使用ssh -vT git@github.com时,我得到以下内容:

  OpenSSH_6.2p2,OSSLShim 0.9.8r 2011年12月8日
debug1:读取配置数据/ etc / ssh_config
debug1:/ etc / ssh_config第20行:为*
应用选项debug1:连接到github.com [192.30.252.129]端口22.
debug1:建立连接。
debug1:身份文件/Users/XXXX/.ssh/id_rsa类型-1
debug1:身份文件/Users/XXXX/.ssh/id_rsa-cert类型-1
debug1:身份文件/Users/XXXX/.ssh/id_dsa类型-1
debug1:身份文件/Users/XXXX/.ssh/id_dsa-cert类型-1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_6.2
debug1:远程协议版本2.0,远程软件版本libssh-0.6.0
debug1:不匹配:libssh-0.6.0
debug1 :SSH2_MSG_KEXINIT发送
debug1:SSH2_MSG_KEXINIT收到
debug1:kex:server->客户端aes128-ctr hmac-sha1 none
debug1:kex:client->服务器aes128-ctr hmac-sha1 none
debug1:发送SSH2_MSG_KEXDH_INIT
debug1:期望SSH2_MSG_KEXDH_REPLY
debug1:服务器主机密钥:RSA 16:27:ac:a5:76:28:2d:36:63:1b:56: 4d:eb:df:a6:48
debug1:主机'github.com'是已知的并且与RSA主机密钥匹配。
debug1:找到密钥在/Users/XXXX/.ssh/known_hosts:1
debug1:ssh_rsa_verify:签名正确
debug1:SSH2_MSG_NEWKEYS发送
debug1:期待SSH2_MSG_NEWKEYS
debug1:SSH2_MSG_NEWKEYS收到
debug1:漫游不被服务器允许
debug1:发送SSH2_MSG_SERVICE_REQUEST
debug1:收到SSH2_MSG_SERVICE_ACCEPT
debug1:可继续的身份验证:publickey
debug1:下一步身份验证方法:publickey
debug1:尝试私钥:/Users/XXXX/.ssh/id_rsa
debug1:尝试私钥:/Users/XXXX/.ssh/id_dsa
debug1:不再身份验证方法尝试。
权限被拒绝(publickey)。

接下来,eval$(ssh-agent -s)返回Agent pid 2314
但是,ssh-add -l返回代理没有身份。



这就是我卡住的地方。我试着用Google搜索这个问题,然后在这里搜索。我尝试访问ssh目录中的文件,但没有。



有人可以帮我解决这个问题吗?

>

详细资料请参阅 answer 。总而言之,当 ssh-add -l <​​/ code>返回代理没有身份 $ b

/ code>这意味着 ssh (存储在诸如〜/ .ssh / id_rsa,〜/ .ssh / id_dsa等文件中)所使用的键是缺少身份验证代理( ssh-agent )不知道它们,或者它们的权限设置不正确(例如,可写入世界)。



如果您的密钥丢失(即您没有生成任何密钥),请使用'ssh-keygen'(例如, ssh-keygen -t rsa )来生成它们,然后使用 ssh-add 来添加它们。



如果存在键但不知道到 ssh-agent (例如,它们可能位于非标准文件夹中)使用'ssh-add'(例如, ssh-add / path / to / my-ssh-folder / id_rsa )来添加它们。 answer 如果您遇到 ssh-add ss h-agent


This is my first time accessing github and I'm not experienced using console. I'm on a Macbook (using Bash). When I try to access github, I get this:

git clone git@github.com:dhulihan/league-of-legends-data-scraper.git
Cloning into 'league-of-legends-data-scraper'...
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

I've tried following the instructions on Github page about Permission denied When I use ssh -vT git@github.com, I get the following:

OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to github.com [192.30.252.129] port 22.
debug1: Connection established.
debug1: identity file /Users/XXXX/.ssh/id_rsa type -1
debug1: identity file /Users/XXXX/.ssh/id_rsa-cert type -1
debug1: identity file /Users/XXXX/.ssh/id_dsa type -1
debug1: identity file /Users/XXXX/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version libssh-0.6.0
debug1: no match: libssh-0.6.0
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-sha1 none
debug1: kex: client->server aes128-ctr hmac-sha1 none
debug1: sending SSH2_MSG_KEXDH_INIT
debug1: expecting SSH2_MSG_KEXDH_REPLY
debug1: Server host key: RSA 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /Users/XXXX/.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: Roaming not allowed by server
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: /Users/XXXX/.ssh/id_rsa
debug1: Trying private key: /Users/XXXX/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).

Next, eval "$(ssh-agent -s)" returns "Agent pid 2314" However, ssh-add -l returns "The agent has no identities."

And that's where I'm stuck. I've tried googling this problem and searching here on SO. I've tried accessing files in the ssh directory, but there are none. Just a folder called Knownusers.

Can someone help me with this issue?

解决方案

Full details in this answer.

In summary, when ssh-add -l returns The agent has no identities it means that keys used by ssh (stored in files such as ~/.ssh/id_rsa, ~/.ssh/id_dsa, etc) are either missing, they are not known to the authentication agent (ssh-agent), or their permissions are set incorrectly (e.g., world writable).

If your keys are missing (i.e., you have not generated any keys), use 'ssh-keygen' (e.g., ssh-keygen -t rsa) to generate them, then use ssh-add to add them.

If keys exist but are not known to ssh-agent (e.g., they may be in a non-standard folder) use 'ssh-add' (e.g., ssh-add /path/to/my-ssh-folder/id_rsa) to add them.

See this answer if you are having trouble with ssh-add or ssh-agent.

这篇关于Github权限被拒绝:ssh add agent没有身份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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