Mac環境下終端(Terminal)用ssh 連接服務器問題 Received disconnect from 120.55.x.x: 2: Too many authentication failures for root


由於這台Mac配置git生成公鑰后,ssh連接就出現來這個問題

Received disconnect from 120.55.x.x: 2: Too many authentication failures for root

出現后只需要在 ssh 后面 加上 -o PubkeyAuthentication=no 這個參數,連接正常。

如果不想每次加-o參數就添加個配置文件(默認沒有) ~/.ssh/config

PreferredAuthentications password

測試連接正常。

-----------------------------分割線----------------------------------

回頭再push origin的時候又出現了這樣的問題

git push origin master

Warning: Permanently added the RSA host key for IP address '192.30.252.128' to the list of known hosts.

Permission denied (publickey).

fatal: Could not read from remote repository.

 

Please make sure you have the correct access rights

and the repository exists.


-----------------------------分割線----------------------------------

   vi ~/.ssh/config

   注釋掉

#PreferredAuthentications password
提交正常

git push origin master

Counting objects: 3, done.

Delta compression using up to 4 threads.

Compressing objects: 100% (3/3), done.

Writing objects: 100% (3/3), 992 bytes | 0 bytes/s, done.

Total 3 (delta 0), reused 0 (delta 0)

To git@github.com:l496501043/first.git

   d0cff78..8399039  master -> master

-----------------------------分割線----------------------------------

       又回去 ssh 120.55.x.x -l root

 

      連接不上,繼續push origin到github也正常

       

      那就接着加參數連接ssh 120.55.x.x -l root -o PubkeyAuthentication=no

-----------------------------分割線----------------------------------

-----------------------------分割線----------------------------------

-----------------------------分割線----------------------------------
 


免責聲明!

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



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