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执行以下操作
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公钥,即可
码云:设置->ssh公钥
github:settings->SSH and GPG keys