用git報錯,解決Unable to negotiate with **** port 22: no matching host key type found. Their offer: ssh-rsa


windows電腦重裝系統,去官網下載了最新的git安裝,一路next下來,打開bash按老路子設置,生成公鑰

git config --global user.name "yourname"

git config --global user.email "your@email.com"

ssh-keygen -t rsa -C "your@email.com"

把公鑰添加到阿里雲,clone代碼時拉不下來,報錯。

Unable to negotiate with **** 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客戶端不支持ssh-rsa算法,要修改本地配置重新使用ssh-rsa算法。

具體做法:到當前用戶目錄下的.ssh文件中創建config文件(config沒有后綴),使用記事本打開添加如下

Host *
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedKeyTypes +ssh-rsa

參考鏈接:https://blog.csdn.net/gongjin28_csdn/article/details/120783931

https://ttys3.dev/post/openssh-8-8-p1-no-matching-host-key-type-found-their-offer-ssh-rsa/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM