내 컴퓨터를 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).