解决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 
// 请确保您具有正确的访问权限并且存储库存在

原因:

公钥配置出问题了,删除旧公钥,重新配置新公钥即可。

解决步骤:

  • 删除.ssh下所有文件

  • 在桌面上点击鼠标右键,进入git bash hear

  • 配置本地用户名及邮箱

# 配置用户名
git config --global user.name "用户名"
# 配置邮箱
git config --global user.email "邮箱地址"

以上命令执行结束后,可用 git config list 命令查看配置是否成功

  • git生成公钥

在git bash窗口输入下面指令即可生成带注释的公钥

ssh-keygen -t rsa

输入代码后按回车3下(为什么按三下,是因为有提示你是否需要设置密码,如果设置了每次使用Git都会用到密码,一般都是直接不写为空,直接回车就好了)。会在.ssh文件夹里面生成一个私钥 id_rsa和一个公钥id_rsa.pub。

如需在代码窗查看可执行查看公钥的命令:

cat ~/.ssh/id_rsa.pub
  • 打开代码管理平台,配置SSH密钥即可

最后再重新去提交代码即可,问题迎刃而解 !

猜你喜欢

转载自blog.csdn.net/hudabao888666/article/details/129047021