Debian 9 - Sign_and_send_pubkey

Debian 9 - Sign_and_send_pubkey

我决定开始将我的机器从 Ubuntu 切换到纯 Debian,但目前我在配置与 ssh 相关的 git 存储库时遇到了障碍。我创建了一个新密钥并将其添加到远程服务器,但每当我尝试提取存储库时,我都会收到错误:

xxx@xxx:~/Documents/my-repo$ git pull
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

我的权限似乎都是正确的:

xxx@xxx:~$ ls -al .ssh
total 20
drwx------  2 xxx xxx 4096 Apr  4 12:50 .
-r--------  1 xxx xxx 3381 Apr  4 12:46 id_rsa
-rw-r--r--  1 xxx xxx  740 Apr  4 12:46 id_rsa.pub

另外,还列出了密钥:

xxx@xxx:~$ ssh-add -l
4096 SHA256:my-hash my-comment (RSA)

但是,如果我执行以下操作,它会起作用:

xxx@xxx:~/Documents/my-repo$ ssh-agent git pull
Already up-to-date.

我发现了几篇具有相同 ssh 错误的文章,但这些文章中的解决方案没有帮助(即我的权限似乎已经正确,我的密钥已添加/识别等)。我已经在空闲时间断断续续地思考这个问题了好几个星期了,但一直无法解决。

根据评论中的建议,我运行了以下命令:

xxx@xxx:~/Documents/my-repo$ GIT_TRACE=true git pull
12:46:02.190213 git.c:371               trace: built-in: git 'pull'
12:46:02.192426 run-command.c:350       trace: run_command: 'fetch' '--update-head-ok'
12:46:02.192653 exec_cmd.c:116          trace: exec: 'git' 'fetch' '--update-head-ok'
12:46:02.198382 git.c:371               trace: built-in: git 'fetch' '--update-head-ok'
12:46:02.200462 run-command.c:350       trace: run_command: 'ssh' '[email protected]' 'git-upload-pack '\''xxx/my-repo.git'\'''
sign_and_send_pubkey: signing failed: agent refused operation
Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

其次是:

xxx@xxx:~/Documents/my-repo$ ssh -v [email protected] git-upload-pack xxx/my-repo.git
OpenSSH_7.4p1 Debian-10+deb9u6, OpenSSL 1.0.2r  26 Feb 2019
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to gitlab.com [35.231.145.151] port 22.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/xxx/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4p1 Debian-10+deb9u6
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* compat 0x04000000
debug1: Authenticating to gitlab.com:22 as 'git'
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 /home/xxx/.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_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 RSA public key: /home/xxx/.ssh/id_rsa
debug1: Server accepts key: pkalg rsa-sha2-512 blen 535
sign_and_send_pubkey: signing failed: agent refused operation
debug1: Trying private key: /home/xxx/.ssh/id_dsa
debug1: Trying private key: /home/xxx/.ssh/id_ecdsa
debug1: Trying private key: /home/xxx/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

相关内容