【发布时间】:2022-01-10 13:01:00
【问题描述】:
我无法通过 SSH 访问 GitHub.com(用于使用 GitHub 桌面推送)。我的客户端是 Windows 10 系统。 它曾经工作到昨天。我遇到了一些问题,然后我决定重新初始化 SSH 环境。我删除了服务器(GitHub.com)端的公钥,然后再次添加。从那以后我就陷入了困境。推送时我看到:
我创建了一个 ed25519 公钥/私钥对并将公钥添加到服务器。一切似乎都很好。 发出“ssh -T git@github.com”时,响应为:
PS C:\WINDOWS\system32> ssh git@github.com
PTY allocation request failed on channel 0
Hi <user>! You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
当发出“sss -T @github.com”时,响应是:
PS C:\WINDOWS\system32> ssh <user>@github.com
<user>@github.com: Permission denied (publickey).
完整的痕迹是:
PS C:\WINDOWS\system32> ssh -vT <user>@github.com
OpenSSH_for_Windows_8.1p1, LibreSSL 3.0.2
debug1: Connecting to github.com [140.82.121.4] port 22.
debug1: Connection established.
debug1: identity file C:\\Users\\User/.ssh/id_rsa type -1
debug1: identity file C:\\Users\\User/.ssh/id_rsa-cert type -1
debug1: identity file C:\\Users\\User/.ssh/id_dsa type -1
debug1: identity file C:\\Users\\User/.ssh/id_dsa-cert type -1
debug1: identity file C:\\Users\\User/.ssh/id_ecdsa type -1
debug1: identity file C:\\Users\\User/.ssh/id_ecdsa-cert type -1
debug1: identity file C:\\Users\\User/.ssh/id_ed25519 type -1
debug1: identity file C:\\Users\\User/.ssh/id_ed25519-cert type -1
debug1: identity file C:\\Users\\User/.ssh/id_xmss type -1
debug1: identity file C:\\Users\\User/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_for_Windows_8.1
debug1: Remote protocol version 2.0, remote software version babeld-8eb00d7e
debug1: no match: babeld-8eb00d7e
debug1: Authenticating to github.com:22 as '<user>'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
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: ecdsa-sha2-nistp256 SHA256:p2QAMXNIC1TJYWeIOttrVc98/R1BUFWu3/LiyKgUfQM
debug1: Host 'github.com' is known and matches the ECDSA host key.
debug1: Found key in C:\\Users\\User/.ssh/known_hosts:7
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: <email> ED25519 SHA256:n1SJK1uvYimJC8EhOeJXmLUskx4CWQd2HQ/kjT0BKzg agent
debug1: Will attempt key: C:\\Users\\User/.ssh/id_rsa
debug1: Will attempt key: C:\\Users\\User/.ssh/id_dsa
debug1: Will attempt key: C:\\Users\\User/.ssh/id_ecdsa
debug1: Will attempt key: C:\\Users\\User/.ssh/id_ed25519
debug1: Will attempt key: C:\\Users\\User/.ssh/id_xmss
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,sk-ssh-ed25519-cert-v01@openssh.com,sk-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,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@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: <email> ED25519 SHA256:n1SJK1uvYimJC8EhOeJXmLUskx4CWQd2HQ/kjT0BKzg agent
debug1: Authentications that can continue: publickey
debug1: Trying private key: C:\\Users\\User/.ssh/id_rsa
debug1: Trying private key: C:\\Users\\User/.ssh/id_dsa
debug1: Trying private key: C:\\Users\\User/.ssh/id_ecdsa
debug1: Trying private key: C:\\Users\\User/.ssh/id_ed25519
debug1: Trying private key: C:\\Users\\User/.ssh/id_xmss
debug1: No more authentication methods to try.
<user>@github.com: Permission denied (publickey).
对此有什么想法吗?
【问题讨论】:
-
您不应该使用您的用户名。你总是应该使用
git@github.com,它表明它工作得很好。向我们展示您的存储库中git remote -v的输出,以及您尝试从命令行推送时得到的结果(作为编辑到您问题中的代码块)。
标签: github ssh permission-denied ed25519