权限被拒绝(公钥)。 GitLab 突然出现错误。我正确配置了私钥和公钥

时间:2021-03-04 21:41:15

标签: git gitlab ssh-keys

从今天起,我遇到了“权限被拒绝(公钥)”的问题。确实两天前一切正常。

这里有一些信息:

我在 2 个月前生成了私钥和公钥。我 2 天前创建了一个新的私人项目,一切正常。实际上,在 https://.../profile/keys 中的 GitLab 配置文件中,我可以看到我的 SSH 密钥已在 2 天前使用过。

但是现在如果我尝试输入:ssh -Tv git@xxx

我的权限被拒绝:

OpenSSH_8.4p1, OpenSSL 1.1.1i  8 Dec 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to xxx [130.192.16.165] port 22.
debug1: Connection established.
debug1: identity file /c/Users/xxx/.ssh/id_rsa type -1
debug1: identity file /c/Users/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_dsa type -1
debug1: identity file /c/Users/xxx/.ssh/id_dsa-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_ecdsa type -1
debug1: identity file /c/Users/xxx/.ssh/id_ecdsa-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_ecdsa_sk type -1
debug1: identity file /c/Users/xxx/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_ed25519 type 3
debug1: identity file /c/Users/xxx/.ssh/id_ed25519-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_ed25519_sk type -1
debug1: identity file /c/Users/xxx/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /c/Users/xxx/.ssh/id_xmss type -1
debug1: identity file /c/Users/xxx/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.10 pat OpenSSH_7.0*,OpenSSH_7.1*,OpenSSH_7.2*,OpenSSH_7.3*,OpenSSH_7.4*,OpenSSH_7.5*,OpenSSH_7.6*,OpenSSH_7.7* compat 0x04000002
debug1: Authenticating to xxx:22 as 'vgit'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
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:g6mCwdFaFWdQG0rfBcIGGXDQNvJR0tan+sF8N53Tvow
debug1: Host 'xxx' is known and matches the ECDSA host key.
debug1: Found key in /c/Users/xxx/.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: /c/Users/xxx/.ssh/id_rsa
debug1: Will attempt key: /c/Users/xxx/.ssh/id_dsa
debug1: Will attempt key: /c/Users/xxx/.ssh/id_ecdsa
debug1: Will attempt key: /c/Users/xxx/.ssh/id_ecdsa_sk
debug1: Will attempt key: /c/Users/xxx/.ssh/id_ed25519 ED25519 SHA256:uEcoFZk1Nh6/5KRdoKFtktiOtX8qoUupC4ohwKrvvWA
debug1: Will attempt key: /c/Users/xxx/.ssh/id_ed25519_sk
debug1: Will attempt key: /c/Users/xxx/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<rsa-sha2-256,rsa-sha2-512>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /c/Users/xxx/.ssh/id_rsa
debug1: Trying private key: /c/Users/xxx/.ssh/id_dsa
debug1: Trying private key: /c/Users/xxx/.ssh/id_ecdsa
debug1: Trying private key: /c/Users/xxx/.ssh/id_ecdsa_sk
debug1: Offering public key: /c/Users/xxx/.ssh/id_ed25519 ED25519 SHA256:uEcoFZk1Nh6/5KRdoKFtktiOtX8qoUupC4ohwKrvvWA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /c/Users/xxx/.ssh/id_ed25519_sk
debug1: Trying private key: /c/Users/xxx/.ssh/id_xmss
debug1: No more authentication methods to try.
vgit@xxx: Permission denied (publickey).

为什么我有两天的权限,现在却没有了?

我在 Window 10 上使用 Git Bash

1 个答案:

答案 0 :(得分:0)

我今天复制了相同的命令,现在它可以工作了。我不能说为什么昨天它不起作用。计算机科学的奥秘。