git错误总结

作者: icessun | 来源:发表于2017-08-03 10:08 被阅读225次

错误一

Updates were rejected because the remote contains work that you do

 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/icessun/baiduWebShool.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.


错误的原因是:远程仓库包含你本地所没有的更新,可能是被其他人推送进去,故你应该合并这些变化在你准备推送之前


解决办法:

$ git pull origin master     抓取远端的内容
$ git push origin master     重新推送到远程仓库

错误二

Your local changes to the following files would be overwritten by checkout:

Administrator MINGW32 /d/blog (dev)
$ git checkout master
error: Your local changes to the following files would be overwritten by checkout:
        .idea/workspace.xml
Please commit your changes or stash them before you switch branches.
Aborting


错误的原因是:直接在远程仓库包操作了,修改了github上面的东西,相当于服务器上面的东西,而本地没有修改,当想改变分支的时候,出现了改变分支的时候会重写文件,所以必须把修改的提交到版本库里面。或者是隐藏在你切换分支之前。


解决办法:

  • 抛弃本地的修改,回到上一个版本
git reset --hard
然后,切换你的分支
git checkout master 

错误三

src refspec remote does not match any

$ git push origin remote
error: src refspec remote does not match any.
error: failed to push some refs to 'git@github.com:icessun/ife-fcc.git'

查看了stackoverflow上面的解答,发现是目录中没有文件,空目录是不能提交上去的


解决办法:

$ git push -u origin remote

错误四

错误四

解决办法:

git config http.postBuffer 524288000

错误五

git pull 失败 ,提示:fatal: refusing to merge unrelated histories


错误五

解决办法:
git pull origin master --allow-unrelated-histories

相关文章

  • git错误总结

    错误一 Updates were rejected because the remote contains wor...

  • Git_6_分支合并

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 通常,Git在合并...

  • Git_7_Bug分支

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 我们将GIt运用到...

  • 前言

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。

  • Git_1_安装

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 windows下通...

  • Git_3_文件修改

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 我们现在可以修改一...

  • Git_2_基本使用

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 1.新建仓库 可以...

  • Git_4_版本操作

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 现在我们已经学会了...

  • Git_8_标签管理

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 在版本操作中我们已...

  • Git_5_分支管理

    本Git系列内容更多是基于廖雪峰老师的Git教程的个人笔记、总结和扩展,如有错误,请多多指正。 在上一节中,我们随...

网友评论

    本文标题:git错误总结

    本文链接:https://www.haomeiwen.com/subject/dywulxtx.html