记录下在使用git的过程中遇见的错误,持续更新中…
1.fatal: refusing to merge unrelated histories
执行 git pull origin branchname --allow-unrelated-histories
命令
2.error: pathspec ‘commit” did not match any file(s) known to git.
场景:当执行 git commit -m ‘first commit’时出现这个错误
解决方案:这是由于单引号的原因,改为双引号即可
3.error: failed to push some refs to ‘https://github.com/xxxx/xxxx.git’
场景:git push
解决方案:
git pull origin master --allow-unrelated-histories
git pull origin master
4.fatal: Not a git repository (or any of the parent directories): .git
场景:git remote add origin https://xxx/xx.git
原因:这是由于当前目录下没有.git目录
解决方案:执行 git init
进行初始化