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 "youremail@example.com"
然后把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 “邮箱地址”