一、我在使用git 的遇到“Could not read from remote repository.Please make sure you have the correct access rights”

开始看不懂是什么错,然后自己百度一下,发现是ssh key的问题,看了答案但都不是很完整,所以自己整理一哈,加深印象预防下次再次出现此问题。

解决方法如下:

1、git输入命令:$ ssh-****** -t rsa -C "[email protected]"(请填你设置的邮箱地址)

如果执行成功返回:

Generating public/private rsa key pair.

Enter file in which to save the key (/Users/username/.ssh/id_rsa): 

然后直接按回车,接着系统会自动在.ssh文件夹下生成两个文件,分别是id_rsa和id_rsa.pub,用记事本打开id_rsa.pub复制里面全部内容。

2、打开github官网登陆自己的账户,进入设置,点击SSH and GPG keys打开该页面,把刚才复制的粘贴在key中,入下图:

git提交出现”Could not read from remote repository.Please make sure you have the correct access rights”错误

title可以不填,最后点击add ssh key。

3、在git中输入:ssh -T [email protected],然后根据提示输入命令yes,回车就会提示你成功。




二、同一天我还遇到了“fatal: remote origin already exists ”错误,所以就一并记了解决方法。

解决方法如下:

1、先删除远程Git仓库

git remote rm origin

2、再添加远程Git仓库

git remote add origin url(要添加的远程仓库地址)




相关文章:

  • 2021-09-26
  • 2021-12-25
  • 2018-09-07
  • 2021-09-09
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
  • 2021-03-26
猜你喜欢
  • 2021-10-19
  • 2021-10-30
  • 2021-07-18
  • 2022-01-06
  • 2022-12-23
相关资源
相似解决方案