git使用ssh clone時報錯

使用ssh地址 clone 時可能會出現如下錯誤

Cloning into 'music'...
The authenticity of host 'gitee.com (*.*.*.*)' can't be established.
ECDSA key fingerprint is SHA256:FQGC9Kn/eye1W8icdBgrQp+KkGYoFgbVr17bmjey0Wc.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'gitee.com,*.*.*.*' (ECDSA) to the list of known hosts.
git@gitee.com: Permission denied (publickey).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

解決方案: 先刪除.ssh文件夾 在cmd執行如下操做git

ssh-keygen -t rsa -C "倉庫帳號"
一路回車
Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\Administrator/.ssh/id_rsa):  
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in C:\Users\Administrator/.ssh/id_rsa.
Your public key has been saved in C:\Users\Administrator/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:c8bnbdAxC2/bpv93AlQKgQURlIpxVu3fgO4iMtuPigc '1793337019@qq.com'
The key's randomart image is:
+---[RSA 2048]----+
|       o*Oo.     |
|    . o o o   .  |
|     = . . o.oo  |
|    . .  .o ++ + |
|        S.+ooo=  |
|  E      +.oo+.o |
|   .     .  ..+ o|
|   .+.... .  ..oo|
|  ..o=oo..    .o*|
+----[SHA256]-----+

此時已生成id_rsa.pub 文件,到github等遠端倉庫配置ssh公鑰,便可github

碼雲:設置->ssh公鑰
github:settings->SSH and GPG keys
相關文章
相關標籤/搜索