当前位置: 首页 > 知识库问答 >
问题:

GitHub:权限被拒绝(公钥),但我得到“您已经成功验证”消息

陈增
2023-03-14
$ 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)
$ git clone git@github.com: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.

下面是我运行的输出

$ ssh -Tv git@github.com

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

正如上面的行显示的嗨Tomkim!您已经成功地进行了身份验证,但GitHub不提供shell访问。这意味着我已经不受诱惑了,但为什么我不能克隆我的repo呢?

更新:我可以在我的主目录中克隆,但是当我尝试使用sudo时,它没有工作,它发生在我的/var/www/html/文件夹中

共有1个答案

冯宏恺
2023-03-14

答案是相关的用户权限问题。我需要为当前用户设置正确的文件夹权限。

对于git sudo问题,可以在下面的链接中找到答案:

https://help.github.com/articles/error-permission-denied-publickey/#should-the-sudo-command-be-used with-git

 类似资料:
  • 我正在使用终端,我在根,GitHub存储库存在,我不知道现在该做什么。

  • 我们有一个共同的LDAP帐户/用户。我们计划使用此用户为我们的团队配置 Jenkins。 < li >我使用我的登录名登录到机器/虚拟机并安装了Jenkins。 < li >然后,我仅从我的帐户生成ssh密钥,但我在生成ssh密钥时提供的电子邮件id是普通用户。 < li >然后我将公共ssh密钥添加到Github中(在GitHub中,我使用普通用户登录)。 < li >将私钥添加到Jenkins

  • 我无法使用ssh密钥访问我的repo。当我尝试将git推送到gitlab上的代表时,它会询问密码短语。 我从头开始的步骤。我要到~/. ssh/和此文件夹中的所有文件。然后: > 创建ssh密钥mymail@gmail.com“-b 4096 然后在~/. ssh/

  • 与firebase_ auth和firebase_。使用电子邮件和密码进行身份验证。这是用于身份验证和处理身份验证更改事件的代码提取。验证成功后,代码将用户信息插入实时数据库。如果数据库规则设置为读/写真,则一切正常。但是,使用标准数据库写入规则(auth!=null),应用程序抛出DatabaseError:权限被拒绝。数据库插件似乎不知道经过身份验证的身份?你知道怎么回事吗? 然后: 我已经写

  • 我正在尝试使用playbook更改密码,但未获得这样做的权限。 我正在运行命令: 致命:[主机1]:无法访问=

  • 权限被拒绝(公钥)。致命:无法从远程存储库读取。 请确保您具有正确的访问权限,并且存储库存在。 Gitlab版本6-4稳定 并试图推动 root@gitlab:/home/git/repository/test#git推送源代码主 权限被拒绝(公钥)。致命:无法从远程存储库读取。请确保您有正确的访问权限,并且存储库存在。 shh-vvgit@xxx.xxx alex@xxxxx:~$sshgit@