GitHub:fatal: Could not read from remote repository.的解决办法

最近使用GitHub通过gitbash搭建远程项目过程中
git push -u origin master
出现
Please make sure you have the correct access rights and the repository exists
或者
fatal:Could not read from remote repository.
Pleasemake sure you have the correct access rights
and the repository exists.在这里插入图片描述
这样的问题
查阅资料,主要原因是由于本地(或者服务器上)没有生成ssh key

解决方法:
1、生成你的ssh key;
ssh-keygen -t rsa -C “10022*****@qq.com” 一路回车即可。

ssh -v git@github.com
结尾是:
结尾
ssh-agent -s

ssh-add ~/.ssh/id_rsa

这时候应该会提示:

Identity added: …(这里是一些ssh key文件路径的信息)

如果出现错误提示:

Could not open a connection to your authentication agent.

命令:eval ssh-agent -s后继续执行命令 ssh-add ~/.ssh/id_rsa,这时候一般没问题啦。
在这里插入图片描述
2、打开你刚刚生成的id_rsa.pub文件(注意是.pub文件)将里面的内容复制,进入你的github账号,在settings下,SSH and GPG keys下new SSH key,title随便取一个名字,然后将id_rsa.pub里的内容复制到Key中,完成后Add SSH Key。

3、$ssh -T git@github.com
在这里插入图片描述
4、再次
$ git push -u origin master

解决了!!!

本文主要参考:
1、王老头:https://www.cnblogs.com/wmr95/p/7852832.html
2、https://blog.csdn.net/jingtingfengguo/article/details/51892864

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值