git "Could not read from remote repository.Please make sure you have the correct access rights."解决方案

git clone 项目时,出现Could not read from remote repository.Please make sure you have the correct access rights.

这里写图片描述
这就说明你没有添加github的SSH Key或者需要重新添加。

步骤如下:

1、重新在git设置一下身份的名字和邮箱
git config –global user.name “yourname”
git config –global user.email“your@email.com”
没有返回是最好的回馈,说明设置成功
global 前面是双-

2、C盘搜索.ssh文件,删除known_hosts

3、Git Bash中输入
ssh-keygen -t rsa -C “your@email.com”(刚才设置的邮箱)

出现:Generating public/private rsa key pair.
Enter file in which to save the key (/Users/your_user_directory/.ssh/id_rsa):
直接按下回车命令行结束
这里写图片描述

这样会在刚才的文件夹里新生成两个文件。id_rsa和id_rsa.pub
用记事本打开id_rsa.pub ,Ctrl+A全部复制。

4、打开Github主页,登录账户->设置->SSH和GPG Keys->New SSH Key
Title : mySSH
Key : 粘贴刚才复制的
点击Add New Key.

5、在git中输入命令:
ssh -T git@github.com
输入yes
这里写图片描述

继续刚才的git clone

这里写图片描述

结束。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值