首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Github权限被拒绝(publickey)不提供shell访问

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

Stack Overflow用户
提问于 2017-07-21 10:14:58
回答 2查看 3K关注 0票数 1

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

代码语言:javascript
复制
git submodule update --init --recursive

然后我收到错误消息,说权限被拒绝(Publickey Key),我尝试搜索并运行下面的注释来创建ssh密钥:

代码语言:javascript
复制
ssh-keygen -t rsa -C "xxx@xxx.com"

并通过网站添加了ssh key,并运行以下命令查看是否修复:

代码语言:javascript
复制
ssh -T git@github.com

但它告诉我,我已经成功地进行了身份验证,但是GitHub没有提供外壳access.Then,所以我运行以下命令进行调试:

代码语言:javascript
复制
ssh -vT git@github.com

下面是输出:

代码语言:javascript
复制
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

有人知道怎么解决这个问题吗?非常感谢!

EN

回答 2

Stack Overflow用户

发布于 2017-07-21 12:39:47

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

这取决于子模块的URL,您可以在存储库的.gitmodules文件中读取该子模块。

或者,它可以依赖于一个子模块的子模块的URL,但如果没有克隆任何子模块,如果错误立即显示,则问题应该仅限于直接的第一级子模块。

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

票数 1
EN

Stack Overflow用户

发布于 2017-07-21 10:17:45

这很好,不是错误。

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

即使git使用ssh协议和登录机制,您也不能在Github的服务器上通过ssh进入一个完整的shell会话。但不管怎样,你不需要它。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/45227931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档