git拉取代碼報錯:
Unable to negotiate with 172.18.19.44 port 22: no matching host key type found. Their offer: ssh-rsa
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
SSH有幾種不同類型的密鑰:RSA密鑰 (ssh-rsa) 可以支持多種簽名。簽名類型sssh-rsa是指帶有SHA-1的RSA,而簽名類型rsa-sha2-256是帶有SHA-256的RSA,rsa-sha2-512是帶有SHA-512的RSA。
上面報錯中提示,git服務(wù)端中使用的密鑰是ssh-rsa類型的,而我本地的ssh(openSSH 9.x)默認(rèn)不支持這種算法,需要指定下算法
解決方案:
進入~/.ssh目錄,打開config文件(沒有的話新建一個),添加如下配置:文章來源:http://www.zghlxwxcb.cn/news/detail-505443.html
Host {域名}
User git
PubkeyAcceptedAlgorithms +ssh-rsa
HostkeyAlgorithms +ssh-rsa
{域名}替換成你自己的git服務(wù)器域名文章來源地址http://www.zghlxwxcb.cn/news/detail-505443.html
到了這里,關(guān)于git拉取代碼報錯:Unable to negotiate with xxx port xxx: no matching host key type found的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!