【问题标题】:cant ssh into git: PTY allocation request failed on channel 0无法通过 ssh 进入 git:通道 0 上的 PTY 分配请求失败
【发布时间】:2020-09-16 09:30:45
【问题描述】:

我正在尝试更新自制软件,但我无法连接到 git.. 我看到 https 没有通过,当我尝试 ssh -t 我得到: PTY 分配请求在通道 0 上失败 这些是我的结果表单 ssh -v:

klein@MacBook-Pro .ssh % ssh -v git@github.com
OpenSSH_8.1p1, LibreSSL 2.7.3
debug1: Reading configuration data /Users/klein/.ssh/config
debug1: /Users/klein/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 47: Applying options for *
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /users/klein/.ssh/id_rsa type 0
debug1: identity file /users/klein/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.1
debug1: Remote protocol version 2.0, remote software version babeld-42834f78
debug1: no match: babeld-42834f78
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
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 /Users/klein/.ssh/known_hosts:1
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: Will attempt key:  RSA SHA256:FtOwFwwlGSFpdkdM+Po6Yv5CUrgfxPND9Aq/b575NdI agent
debug1: Will attempt key: klein@MacBook-Pro.localdomain RSA SHA256:9hkiUuvWfFm6hbf5l3zsBBIF6MAQkpeAah3ukcq0cOA agent
debug1: Will attempt key: /users/klein/.ssh/id_rsa RSA SHA256:tFpBa6n3n4eB4KtqUFy0dvj3xWnURehYvdB5tr6BbJQ explicit
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key:  RSA SHA256:FtOwFwwlGSFpdkdM+Po6Yv5CUrgfxPND9Aq/b575NdI agent
debug1: Authentications that can continue: publickey
debug1: Offering public key: klein@MacBook-Pro.localdomain RSA SHA256:9hkiUuvWfFm6hbf5l3zsBBIF6MAQkpeAah3ukcq0cOA agent
debug1: Authentications that can continue: publickey
debug1: Offering public key: /users/klein/.ssh/id_rsa RSA SHA256:tFpBa6n3n4eB4KtqUFy0dvj3xWnURehYvdB5tr6BbJQ explicit
debug1: Server accepts key: /users/klein/.ssh/id_rsa RSA SHA256:tFpBa6n3n4eB4KtqUFy0dvj3xWnURehYvdB5tr6BbJQ explicit
Enter passphrase for key '/users/klein/.ssh/id_rsa': 
debug1: Authentication succeeded (publickey).
Authenticated to github.com ([140.82.112.4]:22).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: pledge: network
debug1: Sending environment.
debug1: Sending env LC_CTYPE = UTF-8
PTY allocation request failed on channel 0
Hi kippelicious! 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
Connection to github.com closed.
Transferred: sent 4208, received 2672 bytes, in 0.2 seconds
Bytes per second: sent 17817.7, received 11313.9
debug1: Exit status 1

我已经删除了整个 .ssh 文件夹,安装了新的 ssh 密钥,但没有任何效果。

谁能帮忙?

【问题讨论】:

  • 阅读消息:“Hi kippelicious!您已成功通过身份验证,但 GitHub 不提供 shell 访问权限。”
  • 它是ssh -T(大写 T),它告诉 ssh 不要打扰 pty 分配,它会抑制您看到的错误消息。 (小写的 t 告诉 ssh 即使您认为不需要它也进行 pty 分配,这保证了错误。)但是,正如@Mat 指出的那样,该错误消息无关紧要:您的测试实际上成功了。
  • 另外,GitHub 不是 Git;它是一个存储库托管服务,还为这些存储库提供基于 Web 的界面。

标签: git ssh rsa pty


【解决方案1】:

更好的测试是:

ssh -T git@github.com

那么你只会看到:

Hi kippelicious! You've successfully authenticated, but GitHub does not provide shell access.

这样,你知道你可以开始使用像git@github.com:&lt;me&gt;/&lt;my repo&gt;这样的SSH URL

【讨论】:

    猜你喜欢
    • 2018-03-23
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-04-20
    • 1970-01-01
    • 2016-12-22
    相关资源
    最近更新 更多