输入 git clone 命令时出现Please make sure you have the correct access rights and the repository exists.错误,出现改问题的原因是git服务器没有存储本地ssh**。


解决方法如下:

  1. 删除 .ssh 文件夹C:\Users\Administrator\.ssh(Administrator为本地用户名) 中的 known_hosts(直接删除即可)
    git clone 时候出现 Please make sure you have the correct access rights and the repository exists. 问题

  1. 在下载好的Git中的bin目录下(一般是在C:\Program Files\Git\bin)打开bash.exe输入命令
    ssh-****** -t rsa -C "username" (注:username为你git上的用户名),如果执行成功,就一路回车确定
    git clone 时候出现 Please make sure you have the correct access rights and the repository exists. 问题
    出现这个就说明SSH key就已经生成了。

  1. 然后找到系统自动在.ssh文件夹下生成两个文件,id_rsa和id_rsa.pub,用记事本打开id_rsa.pub将全部的内容复制。
    git clone 时候出现 Please make sure you have the correct access rights and the repository exists. 问题

  1. 打开 github
    登陆账户
    进入Settings
    找到SSH and GPG keys
    点击New SSH key
    然后将你复制的内容粘贴到key中
    git clone 时候出现 Please make sure you have the correct access rights and the repository exists. 问题
    再点击Add SSH Key 即可~

  1. 仍然在bash.exe中输入ssh -T [email protected]然后会跳出一堆内容你只需输入yes回车就完事了,然后他会提示你成功了。
    git clone 时候出现 Please make sure you have the correct access rights and the repository exists. 问题

大功告成,再次输入 git clone 就成功了

相关文章:

  • 2022-01-20
  • 2021-06-25
  • 2022-12-23
猜你喜欢
  • 2021-12-25
  • 2021-10-11
  • 2021-08-14
  • 2021-04-01
  • 2021-12-17
  • 2021-09-23
相关资源
相似解决方案