关于Git Please make sure you have the correct access rights问题解决

今天使用git clone命令报错了,就是秘钥过期了,重新生成添加到github服务器就好了,步骤如下:

  • 删除.ssh文件夹)下的known_hosts文件,在C盘的用户目录下,我的路径
C:\Users\LUMIN\.ssh
  • 打开gitbash工具输入命令
ssh-keygen -t rsa -C "username"

成功后返回以下确认信息:

Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/LUMIN/.ssh/id_rsa):

回车键继续,因为以前有这个文件保存了秘钥信息,所以会返回覆盖的确认信息如下:

/c/Users/LUMIN/.ssh/id_rsa already exists.
Overwrite (y/n)? 

输入y,回车继续,因为以前没有存储地址,返回以下信息:

Enter passphrase (empty for no passphrase):

再次回车,返回再次确认信息:

Enter same passphrase again:

回车确认,返回以下信息,表示已生成SSH Key

Your identification has been saved in /c/Users/LUMIN/.ssh/id_rsa.
Your public key has been saved in /c/Users/LUMIN/.ssh/id_rsa.pub.

找到自动在.ssh文件夹下的id_rsa.pub,把内容复制到github的SSH Key中

最后输入ssh -T git@github.co,测试是否成功,输入yes,继续连接:

The authenticity of host 'github.com (52.74.223.119)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes

以下信息成功

Warning: Permanently added 'github.com,52.74.223.119' (RSA) to the list of known hosts.
Hi luminqiang! You've successfully authenticated, but GitHub does not provide shell access.
posted @ 2021-01-07 13:46  Yeah的第七章  阅读(698)  评论(0编辑  收藏  举报