从gitlab中pulllpush的结果是:Permission denied (publickey)

问题描述 投票:0回答:1

我同时使用git bash和VS代码连接到我的gitlab仓库。一切都很好,直到我创建了一个新的repo,并试图通过git bash将其克隆到本地。我收到的错误是

[email protected]: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.

我试着改变了.ssh文件夹和公钥的权限 增加了一个ssh到代理,但都没有用。

执行 ssh -Tv <user name>@gitlab.com 显示了下面的输出。

OpenSSH_8.2p1, OpenSSL 1.1.1f  31 Mar 2020
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Connecting to gitlab.com [172.65.251.78] port 22.
debug1: Connection established.
debug1: identity file /c/Users/user/.ssh/id_rsa type 0
debug1: identity file /c/Users/user/.ssh/id_rsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_7.2p2 Ubuntu-4ubuntu2.8
debug1: match: OpenSSH_7.2p2 Ubuntu-4ubuntu2.8 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 gitlab.com:22 as 'user'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: [email protected]
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:HbW3g8zUjNSksFbqTiUWPWg2Bq1x8xdGUrliXFzSnUw
debug1: Host 'gitlab.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: pubkey_prepare: ssh_get_authentication_socket: Bad file descriptor
debug1: Will attempt key: /c/Users/user
/.ssh/id_rsa RSA SHA256:rNZDTqdiVzM9+qjPlPV9wpd5Eg0t0tKKMonz+Q6+yGo
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: Offering public key: /c/Users/user/.ssh/id_rsa RSA SHA256:rNZDTqdiVzM9+qjPlPV9wpd5Eg0t0tKKMonz+Q6+yGo
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
<user name>@gitlab.com: Permission denied (publickey).
git ssh gitlab public-key
1个回答
0
投票

我试过改变.ssh文件夹和公钥的权限,添加一个ssh到agent,这些都没有用。

首先,确保你有 登记的内容 id_rsa.pub 到你的GitLab SSH密钥配置文件页面.

如果还是不行,试着重新生成那个密钥,不需要密码(测试一下,并排除任何ssh-agent的问题,它只用于缓存密码)。

ssh-keygen -m PEM -t rsa -P ""

确保你的 Git for Windows 是最新的(2.27)。

请确保 set GIT_SSH= 意思是 解除 GIT_SSH,这不应该是指 putty.exe).

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.