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

git submodule update --init --recursive 

然后我收到错误消息说权限被拒绝(公钥)
我尝试搜索并运行此评论以创建 ssh key :
ssh-keygen -t rsa -C "xxx@xxx.com" 

并通过网站添加 ssh key ,并运行以下命令检查是否已修复:
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 

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

请您参考如下方法:

I ran the first command in my post:git submodule update --init --recursive and it still told me Permission denied (publickey)



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

因此,请仔细检查 .gitmodules 中存在的 URL。文件:其中一个可能会引用一个私有(private)仓库,您的身份验证不会让您访问。


评论关闭
IT序号网

微信公众号号:IT虾米 (左侧二维码扫一扫)欢迎添加!