今天进行git操作时 报错 在查阅尝试后解决了问题 再此总结一下
出错提示如下
Cloning into 'anydoor'...
The authenticity of host 'github.com (13.250.177.223)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'github.com,13.250.177.223' (RSA) to the list of known hosts.
git@github.com: Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
前面的提示可以说是看不懂 也可能和所有人的都不一样 我先认为问题原因是Please make sure you have the correct access rights and the repository exists.
1 首先重新设置一下git的用户名和邮箱
git config --global user.name " "
git config --global user.email“ "
第一个引号里写你的用户名 第二个引号则是邮箱
邮箱忘记了可以在这里查看到
2 删除.ssh文件夹
这个文件夹一般都会在c盘下
如果找不到这个文件夹 输入第三步 你会看到
3
git输入$ ssh-keygen -t rsa -C " "
里面输入你的邮箱
然后两个回车会出现这个 就成功了!
+---[RSA 2048]----+
|... .+ o+* ...|
|o+ o +.ooO X . ..|
|. O o ..+./ + . |
| * o o X . E |
| o + . S . . . |
| . . o . . |
| o |
| . |
| |
+----[SHA256]-----+
4.找到你刚才新建的.ssh文件夹
记事本打开id_rsa.pub 把里面的内容复制一下
5 打开git设置ssh的地方
点击new ssh key
把刚才复制的粘贴到内容里即可!
6
最后一步 命令输入ssh -T git@github.com
回答yes
git就会对你sayhi了!
问题解决