问题描述
我已完成的步骤:
完全按照。
$ $ p $ $ $ $ ssh-agent - s)
Agent pid 31944
$ ssh-add
输入/home/centos7/.ssh/id_rsa的密码短语:
添加的身份:/home/centos7/.ssh/ id_rsa(/home/centos7/.ssh/id_rsa)
$ ssh-add -l
4096 ab:4d:23:23:99:ce:bb:9d:9f:9e :f9:b2:c8:1a:cd:f7 /home/centos7/.ssh/id_rsa(RSA)
然而,当我运行
$ git clone [email protected]:privateRepo / repo.git
克隆到'回购'...
主机'github.com(192.30.252.130)'的真实性无法建立。
RSA密钥指纹是56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48。
您确定要继续连接(是/否)吗?是
警告:永久性地将'github.com,192.30.252.130'(RSA)添加到已知主机列表中。
权限被拒绝(publickey)。
致命:无法从远程存储库读取。
以下是我运行的输出
$ ssh -Tv [email protected]
OpenSSH_6.6.1,OpenSSL 1.0.1e-fips 2013年2月11日
debug1:读取配置数据/ home /centos7/.ssh/config
debug1:/home/centos/.ssh/config第1行:为* github.com应用选项
debug1:读取配置数据/ etc / ssh / ssh_config
debug1:/ etc / ssh / ssh_config第56行:为*
应用选项debug1:连接到github.com [192.30.252.131]端口22.
debug1:建立连接。
debug1:身份文件/home/centos7/.ssh/id_rsa类型1
debug1:身份文件/home/centos7/.ssh/id_rsa-cert类型-1
debug1:身份文件/ home / centos7 / .ssh / id_dsa类型-1
debug1:身份文件/home/centos7/.ssh/id_dsa-cert类型-1
debug1:身份文件/home/centos7/.ssh/id_ecdsa键入-1
debug1:身份文件/home/centos7/.ssh/id_ecdsa-cert类型-1
debug1:身份文件/home/centos7/.ssh/id_ed25519类型-1
debug1 :identity file /home/centos7/.ssh/id_ed25519-cert type -1
debug1:启用协议2.0的兼容模式
debug1:本地版本字符串SSH-2.0-OpenSSH_6.6.1
debug1 :远程协议版本2.0,远程软件版本libssh-0.7.0
debug1:不匹配:libssh-0.7.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:kex:ecdh-sha2-nistp256 need = 20 dh_need = 2 0
debug1:kex:ecdh-sha2-nistp256 need = 20 dh_need = 20
debug1:发送SSH2_MSG_KEX_ECDH_INIT
debug1:期望SSH2_MSG_KEX_ECDH_REPLY
debug1:服务器主机密钥:RSA 56:27 :ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48
debug1:主机'github.com'已知并且与RSA主机密钥匹配。
debug1:找到/home/centos/.ssh/known_hosts:1
中的密钥警告:将IP地址'192.30.252.131'的RSA主机密钥永久添加到已知主机列表中。
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:提供RSA公钥:/ home / centos7 / .ssh / id_rsa
debug1:服务器接受密钥:pkalg ssh-rsa blen 535
debug1:身份验证成功(publickey)。
通过github.com认证([192.30.252.131]:22)。
debug1:通道0:新建[客户端会话]
debug1:进入交互式会话。
debug1:发送环境。
debug1:发送env LANG = en_US.UTF-8
debug1:发送env LC_CTYPE = UTF-8
您好tomkim!您已成功通过身份验证,但GitHub不提供shell访问权限。
debug1:client_input_channel_req:channel 0 rtype退出状态回复0
debug1:通道0:空闲:客户端会话,nchannels 1
转移:发送4128,收到2040字节,0.5秒
每秒字节数:发送8000.8,收到3953.9
debug1:退出状态1
正如上面的行显示您好tomkim!您已成功通过身份验证,但GitHub不提供shell访问权限。
这意味着我已经未经身份验证,但为什么我无法克隆我的回购?
更新:
我可以在我的主目录中克隆,但是当我尝试使用sudo时,它不起作用,它发生在我的/ var / www / html /文件夹中
$ sudo git clone [email protected]/repo.git
克隆到'repo'中...
警告:永久性地添加IP地址的RSA主机密钥地址'192.30.252.131'到已知主机列表。
权限被拒绝(publickey)。
致命:无法从远程存储库读取。
请确保您拥有正确的访问权限
并存在存储库。
$ git clone [email protected]/repo.git
克隆到'repo'中...
remote:计数对象:4741,完成。
remote:合计4741(delta 0),重用0(delta 0),包重用4741
接收对象:100%(4741/4741),30.30 MiB | 5.83 MiB / s,完成。
解决三角洲问题:完成100%(1451/1451)。
[centos @ ip-172-31-12-124〜] $ ll
共4
drwxrwxr-x。 12 centos centos 4096 Jun 15 04:16 repo b
$ b
我知道我可以用HTTPS克隆,但是我想解决这个问题,任何人都可以提供帮助?
答案是相关的用户权限问题。我需要为当前用户设置正确的文件夹权限。
对于git sudo问题,可以在下面的链接中找到答案:
感谢Chris对这个问题的看法。
Step I had done:https://help.github.com/articles/generating-ssh-keys/ follow exactly.
$ eval "$(ssh-agent -s)"
Agent pid 31944
$ ssh-add
Enter passphrase for /home/centos7/.ssh/id_rsa:
Identity added: /home/centos7/.ssh/id_rsa (/home/centos7/.ssh/id_rsa)
$ ssh-add -l
4096 ab:4d:23:23:99:ce:bb:9d:9f:9e:f9:b2:c8:1a:cd:f7 /home/centos7/.ssh/id_rsa (RSA)
However, when I run
$ git clone [email protected]:privateRepo/repo.git
Cloning into 'repo'...
The authenticity of host 'github.com (192.30.252.130)' can't be established.
RSA key fingerprint is 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,192.30.252.130' (RSA) to the list of known hosts.
Permission denied (publickey).
fatal: Could not read from remote repository.
Below is the output I run
$ ssh -Tv [email protected]
OpenSSH_6.6.1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /home/centos7/.ssh/config
debug1: /home/centos/.ssh/config line 1: Applying options for *github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 56: Applying options for *
debug1: Connecting to github.com [192.30.252.131] port 22.
debug1: Connection established.
debug1: identity file /home/centos7/.ssh/id_rsa type 1
debug1: identity file /home/centos7/.ssh/id_rsa-cert type -1
debug1: identity file /home/centos7/.ssh/id_dsa type -1
debug1: identity file /home/centos7/.ssh/id_dsa-cert type -1
debug1: identity file /home/centos7/.ssh/id_ecdsa type -1
debug1: identity file /home/centos7/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/centos7/.ssh/id_ed25519 type -1
debug1: identity file /home/centos7/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.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: kex: ecdh-sha2-nistp256 need=20 dh_need=20
debug1: kex: ecdh-sha2-nistp256 need=20 dh_need=20
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: RSA 56:27:ac:a5:36:28:2d:36:23:1b:56:4d:eb:df:a6:48
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/centos/.ssh/known_hosts:1
Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts.
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: Offering RSA public key: /home/centos7/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 535
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.252.131]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_CTYPE = UTF-8
Hi tomkim! You've successfully authenticated, but GitHub does not provide shell access.
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 4128, received 2040 bytes, in 0.5 seconds
Bytes per second: sent 8000.8, received 3953.9
debug1: Exit status 1
As the line above showed that Hi tomkim! You've successfully authenticated, but GitHub does not provide shell access.
which means I already unthenticated, but why I can't clone my repo?
Update:I can clone in my home directory, but when I try with sudo it did not work, it happen in my /var/www/html/ folder
$ sudo git clone [email protected]/repo.gitCloning into 'repo'...Warning: Permanently added the RSA host key for IP address '192.30.252.131' to the list of known hosts.Permission denied (publickey).fatal: Could not read from remote repository.
Please make sure you have the correct access rightsand the repository exists.
$ git clone [email protected]/repo.gitCloning into 'repo'...remote: Counting objects: 4741, done.remote: Total 4741 (delta 0), reused 0 (delta 0), pack-reused 4741Receiving objects: 100% (4741/4741), 30.30 MiB | 5.83 MiB/s, done.Resolving deltas: 100% (1451/1451), done.[centos@ip-172-31-12-124 ~]$ lltotal 4drwxrwxr-x. 12 centos centos 4096 Jun 15 04:16 repo
I know I can clone with HTTPS, but I would like to solve this issue, anyone can help?
The answer is related user permission issue. I need to set the correct folder permission for current user.
For the git sudo issue, the answer can be found in below link:
Thanks Chris for looking into this question.
这篇关于Github:权限被拒绝(公钥),但我得到了“您已成功验证身份”信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!