Program Language

git push maser "no matching host key type found. Thier offer : ssh-rsa" error

야곰야곰+책벌레 2023. 11. 28. 17:11
728x90
반응형

git에서 ssh 접속 시 no matching host key type found. Thier offer : ssh-rsa 에러가 발생한다.

이는 push나 pull 같은 명령어를 쓸 때 해당된다.

이것은 git의 version이 2.3 이상이 되면 ssh에서 rsa 방식을 지원하지 않아 PubkeyAcceptedAlgorithms와 HostKeyAlgorithms 옵션을 직접 지정해줘야 한다.

 

git 폴더 아래 cofig 파일을 열어 옵션을 추가한다.

[core]
repositoryformatversion = 0
filemode = false
bare = false
logallrefupdates = true
symlinks = false
ignorecase = true
sshCommand = ssh -o HostKeyAlgorithms=+ssh-rsa -o PubkeyAcceptedAlgorithms=+ssh-rsa
[remote "bitbucket"]
url =
ssh://git@192.168.0.39:7999/swstd/topdev.git
fetch = +refs/heads/*:refs/remotes/bitbucket/*

해당 옵션을 추가하면 다음과 같은 에러가 추가된다. (안 날 수도 있다)

서버의 상태와 로컬의 상태가 다르면 발생하기 때문이다.

해당 내용들은 대체로 commit 이 맞지 않아서 그렇다. git pull을 하여 서버로부터 파일을 가져와 맞추는 작업을 해봤지만 진행되지 않았다. 결국 강제 push를 하여 해결하였다.

728x90
반응형