拒绝Github权限(publickey)不提供shell访问权限

时间:2017-07-21 02:14:58

标签: git ssh

我试图在我从git hub克隆的文件夹中运行此命令:

git submodule update --init --recursive

然后我收到错误消息,说明了权限被拒绝(publickey) 我试图搜索这个并运行此评论来创建ssh密钥:

ssh-keygen -t rsa -C "xxx@xxx.com"

并通过网站添加了ssh密钥,并运行下面的命令检查它是否已修复:

ssh -T git@github.com

但它告诉我,我已成功通过身份验证,但GitHub无法提供shell访问权限。然后我运行此命令进行调试:

ssh -vT git@github.com

这是输出:

OpenSSH_7.4p1 Ubuntu-10, OpenSSL 1.0.2g  1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to github.com [192.30.255.112] port 22.
debug1: Connection established.
debug1: identity file /home/edison/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/edison/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Ubuntu-10
debug1: Remote protocol version 2.0, remote software version libssh-0.7.0
debug1: no match: libssh-0.7.0
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /home/edison/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/edison/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 279
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([192.30.255.112]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_MEASUREMENT = zh_CN.UTF-8
debug1: Sending env LC_PAPER = zh_CN.UTF-8
debug1: Sending env LC_MONETARY = zh_CN.UTF-8
debug1: Sending env LANG = en_US.UTF-8
debug1: Sending env LC_NAME = zh_CN.UTF-8
debug1: Sending env LC_ADDRESS = zh_CN.UTF-8
debug1: Sending env LC_NUMERIC = zh_CN.UTF-8
debug1: Sending env LC_TELEPHONE = zh_CN.UTF-8
debug1: Sending env LC_IDENTIFICATION = zh_CN.UTF-8
debug1: Sending env LC_TIME = zh_CN.UTF-8
Hi edisonguocat! 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 3208, received 1776 bytes, in 3.0 seconds
Bytes per second: sent 1062.4, received 588.1
debug1: Exit status 1

任何人都知道如何解决这个问题? 非常感谢!

2 个答案:

答案 0 :(得分:1)

  

我在帖子中运行了第一个命令:git submodule update --init --recursive它仍告诉我Permission denied (publickey)

这取决于子模块的网址,您可以在回购邮件的.gitmodules文件中阅读。 或者它可能取决于一个子模块的子模块的URL,但如果没有克隆子模块,如果立即显示错误,则问题应限于您的直接第一级子模块。

因此请仔细检查.gitmodules文件中的网址:其中一个可能引用私人存储,您的身份验证无法访问。

答案 1 :(得分:0)

这很好,不是错误。

这意味着您的密钥有效,您应该能够使用git命令访问您的存储库。

即使git使用ssh协议和登录机制,也不允许在Github的服务器上进行完整的shell会话。但是你无论如何都不需要。