我们在使用git clone的时候可能会报错:
Could not read from remote repository.Please make sure you have the correct access right
出现问题的原因:
没有在github账号添加 SSH key
解决方法如下:
1、打开CMD终端、或者git bash输入:
ssh-keygen -t rsa -C "123456789@qq.com"
如果执行成功则返回
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/IBM_ADMIN/.ssh/id_rsa)
2、出现上步信息后、直接按回车、返回下面信息:
Enter passphrase (empty for no passphrase):
3、再次回车
Enter same passphrase again:
4、再次回车
Your identification has been saved in /c/Users/IBM_ADMIN/.ssh/id_rsa.
Your public key has been saved in /c/Users/IBM_ADMIN/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:The secret key string/The secret key string dietime1943@gmail.com
The key's randomart image is:
+---[RSA 2048]----+
| .+oB++.+ . |
| . . *+= + o |
| o @ ... |
| = B.o . + |
| o ..S B . |
| . *.= o |
| . . =.+ |
| . . =. |
| Eoo .o. |
+----[SHA256]-----+:
5、执行到上一步说明SSH key就已经生成了。文件目录就是:/c/Users/IBM_ADMIN/.ssh/id_rsa.pub.
我们执行cat命令查看文件的内容:
cat /c/Users/IBM_ADMIN/.ssh/id_rsa.pub.
这时候会看见:
ssh-rsa AAAAB3NzaC1yc2。。。。。。。。。
(说明:ssh-rsa 后面的内容这就是你的SSH keys)
6、把显示出来的SSH keys直接添加到github账户设置里边的SSH keys,最后再执行git clone命令就可以了。