Github权限被拒绝(公钥)不提供shell访问



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

git submodule update --init --recursive

然后我收到错误消息,说权限被拒绝(公钥( 我尝试搜索此内容并运行此评论以创建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

有人知道如何解决这个问题吗? 多谢!

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

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

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

这很好,不是错误。

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

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

最新更新