Permission denied (publickey)的解決辦法
阿新 • • 發佈:2018-12-29
在新增完Coding.net的ssh-key以後,執行ssh -T [email protected]
時,會出現如下錯誤:
Warning: Permanently added the RSA host key for IP address '106.75.4.187' to the list of known hosts. [email protected]: Permission denied (publickey).
這個錯誤在之前新增gitee時也遇到過,當時忘記怎麼處理了,翻了下history,發現執行如下命令即可解決:
ssh-add ~/.ssh/id_rsa.coding
id_rsa.coding
ssh-keygen -t rsa -f ~/.ssh/id_rsa.coding -C "Coding"
接著在~/.ssh/config
中加入如下配置:
Host coding.net IdentityFile ~/.ssh/id_rsa.coding User xxx (此處填寫coding的使用者名稱)
此時再執行ssh -T [email protected]
命令就可以通過了
ssh -T [email protected] Warning: Permanently added the RSA host key for IP address '123.59.85.99' to the list of known hosts. Coding 提示: Hello oka, You've connected to Coding.net via SSH. This is a personal key. xxx,你好,你已經通過 SSH 協議認證 Coding.net 服務,這是一個個人公鑰