出现Please make sure you have the correct access rights and the repository exists.问题解决

问题:

  有一段时间没有用码云了,当输入 git push -u origin master命令出现Please make sure you have the correct access rights and the repository exists.错误,

原因:

  是git服务器没有发现存储本地的ssh密钥。(git服务器已经存在我电脑的ssh秘钥)

解决方案:

  总思路:重新生成新的 ssh秘钥,再把新的秘钥添加到git服务器的ssh公钥上。

  解决问题步骤:

    1. 删除 .ssh 文件夹【C:Users(本地用户名).ssh】 中的 known_hosts(手动删除即可),

    2. 在下载好的Git中的bin目录下(一般是 C:Program FilesGitin)打开bash.exe输入命令ssh-keygen -t rsa -C "username" (注:username为你git上的用户名),

    3. 出现 Enter file in which to save the key (/Users/username/.ssh/id_rsa):  //按回车

    4. 返回/Users/your username/.ssh/id_rsa already exists.Overwrite (y/n)?  //如果以前有存储地址输入y回车

    5. Enter passphrase(empty for no passphrase): //如果以前没有储存地址就会出现这个,直接回车就好

    6. 运行完成时 username/.ssh/id_rsa.pub.(注:username为你git上的用户名)中发现,已经新生成了id_rsa和id_rsa.pub两个文件

      7. 打开id_rsa.pub将全部的内容复制,到 git服务器的 “设置”  >  “安全设置”  >  “ssh公钥”

    

      8. 重新运行命令行就可以正常了。

祝:你们也和我一样顺利解决

 

原文地址:https://www.cnblogs.com/mei1234/p/12874873.html