• 欢迎访问少将全栈,学会感恩,乐于付出,珍惜缘份,成就彼此、推荐使用最新版火狐浏览器和Chrome浏览器访问本网站。
  • 吐槽,投稿,删稿,交个朋友,商务沟通v:ai_draw
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏少将全栈吧

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

Linux admin 6年前 (2018-03-26) 5150次浏览 已收录 0个评论 扫描二维码
win7升级到win10后,Git Bash突然无法clone项目了。显示
fatal: Could not read from remote repository.

以为升级后Git Bash坏掉了,然后准备去官网重新下载一个Git Bash,还没等Git Bash下载完,问题已经解决了。解决的思路是重新生成了ssh key,用如下代码

ssh-keygen -t rsa -C "[email protected]"

然后把id_rsa.pub加入了GitHub,然而经验证并没有什么效果,还是报一样的错误,然后clone了一个新项目。

echo "# mind" >> README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin https://github.com/sxyseo/mind.git
git push -u origin master

应该是加了git remote add origin 后,出现了不一样的错误。

git init
echo "# mind" >> README.md

git add README.md

git commit -m "first commit"
[master (root-commit) 962207c] first commit
1 file changed, 1 insertion(+)
create mode 100644 README.md

git remote add origin https://github.com/sxyseo/mind.git
fatal: remote origin already exists.

git push origin master
fatal: AggregateException encountered.
发生一个或多个错误。
Username for 'https://github.com': whatled
Password for 'https://whatled@github.com':
Counting objects: 3, done.
Writing objects: 100% (3/3), 215 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
To https://github.com/sxyseo/mind.git
* [new branch] master -> master

之后莫名就OK了。或许系统升级后Git的环境配置文件丢失了,可以先git remote add origin 新的地址,然后通过下面的命令重新配置用户信息。

设置用户名 
Git config –global user.name “用户名”
git config –global user.email “邮箱地址”
喜欢 (0)
[🍬谢谢你请我吃糖果🍬🍬~]
分享 (0)
关于作者:
少将,关注Web全栈开发、项目管理,持续不断的学习、努力成为一个更棒的开发,做最好的自己,让世界因你不同。
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址