/
fedora 에서 bitbucket 에 public key 방식으로 연결 실패
fedora 에서 bitbucket 에 public key 방식으로 연결 실패
증상
분명히 windows 에서는 잘 사용하던 key 였는데 fedora 에서 bitbucket.org 에 연결하려고 하니 다음과 같은 에러가 발생했습니다.
$ git clone git@bitbucket.my-repos/my-project.git Cloning into 'my-project'... git@bitbucket.org: Permission denied (publickey). fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists.
저 에러는 공개키 쌍이 안 맞을 때 나은 것이기 때문에 ~/.ssh/config 내용을 확인했지만 이상이 없었습니다.
Host bitbucket.org HostName bitbucket.org User git PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa
디버깅
이럴 때는 디버깅을 위해서 ssh client 로 바로 연결해서 자세한 에러 메시지를 보면 됩니다.
다음 명령어로 Bitbucket 에 ssh 로 연결할 수 있습니다. (github, gitlab 도 동일한 방식으로 연결해 보면 됩니다.)
$ ssh -T git@bitbucket.org git@bitbucket.org: Permission denied (publickey).
이제 자세한 로그를 보기 위해서 verbose 모드로 ssh 를 실행합니다. verbose 모드는 -v 이며 v 가 여러 개일수록 로그 내용이 자세해 지며 최대 옵션은 -vvv 입니다.
$ ssh -v -T git@bitbucket.org ebug1: Host 'bitbucket.org' is known and matches the RSA host key. debug1: Found key in /home/lesstif/.ssh/known_hosts:9 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: /home/lesstif/.ssh/id_rsa RSA SHA256:R/uZtOlrfxd/E0iluzfR69AfP5EsSQjvM4W+9wqvWLo explicit agent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey debug1: Next authentication method: publickey debug1: Offering public key: /home/lesstif/.ssh/id_rsa RSA SHA256:R/uZtOlrfxd/E0iluzfR69AfP5EsSQjvM4W+9wqvWLo explicit agent debug1: send_pubkey_test: no mutual signature algorithm debug1: No more authentication methods to try. git@bitbucket.org: Permission denied (publickey).
로그중 "Will attempt key" 항목을 보면 .ssh/config 에 설정한 공개 키쌍을 사용하는 것을 알수 있습니다.
로그 아래 부분의 다음 메시지가 원인을 유추할 수 있게 해줍니다.
debug1: send_pubkey_test: no mutual signature algorithm
원인
fedora 33 은 SHA1 지원을 뺐는데 bitbucket.org 는 SHA1 을 사용해서 서명 알고리즘이 안 맞아서 발생한 일이었습니다.
workaround 로 .ssh/config 에 Host 설정에 PubkeyAcceptedKeyTypes 항목을 추가해 주면 됩니다.
Host bitbucket.org HostName bitbucket.org User git PubkeyAcceptedKeyTypes ssh-rsa PreferredAuthentications publickey IdentityFile ~/.ssh/id_rsa
Ref
, multiple selections available,
Related content
github, gitlab, bitbucket 에 ssh 공개키가 제대로 등록되었는지 확인하는 방법
github, gitlab, bitbucket 에 ssh 공개키가 제대로 등록되었는지 확인하는 방법
More like this
git bare repository 설정 및 다른 프로토콜(HTTP, SSH) 과 연계
git bare repository 설정 및 다른 프로토콜(HTTP, SSH) 과 연계
More like this
git 에 ssh 로 연결시 verbose mode 로 실행하기
git 에 ssh 로 연결시 verbose mode 로 실행하기
More like this
git annex - git 용 대용량 바이너리 파일 관리 솔루션
git annex - git 용 대용량 바이너리 파일 관리 솔루션
More like this
git 에서 https 로 연결시 "error: Protocol https not supported or disabled in libcurl while accessing https://github.com/" 에러 처리
git 에서 https 로 연결시 "error: Protocol https not supported or disabled in libcurl while accessing https://github.com/" 에러 처리
More like this
git push ERROR: Repository not found 에러 처리
git push ERROR: Repository not found 에러 처리
More like this