1. 程式人生 > >SSH公鑰生成無法使用問題

SSH公鑰生成無法使用問題

配置個GIT SSH公鑰,一直驗證不對

clone一直提示

Authentication failed. You may not have permission to access the repository or the repository may have been archived. Open options and verify that you're signed in with an account that has permission to access this repository.

後來查資料,有人說是因為沒 配置以下資訊

git config --global user.name “使用者名稱”
git config --global user.email “郵箱”

而是直接在配置那裡寫郵箱和使用者名稱,生成的公鑰匙直接顯示我的郵箱,後來拿去用不了;後來我有一步一步寫的時候生成的公鑰其實最後顯示的並不是郵箱,而是本機名,當時我一直以為顯示郵箱是對的

嘗試了以上方法還是不行

最終在廖雪峰老師的論壇裡找到了解決方法

$ ssh -T [email protected]
The authenticity of host 'gitee.com (218.11.0.86)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'gitee.com,218.11.0.86' (ECDSA) to the list of known hosts.
Hi Anonymous! You've successfully authenticated, but GITEE.COM does not provide shell access.
Note: Perhaps the current use is DeployKey.
Note: DeployKey only supports pull/fetch operations

是自己執行的時候,沒有注意到,這裡還需要填寫yes。才能新增到本地SSH信任列表。

【切記】首次使用需要確認並新增主機到本機SSH可信列表

最後終於完美解決