美文网首页
git error Missing tree

git error Missing tree

作者: AndroidXing | 来源:发表于2018-04-01 18:36 被阅读79次

    git 提交有时会出现这个提示,导致提交失败,解决方法是:

    1. 改为用这种方式提交:
      git push --no-thin
      From Git docs::A thin transfer significantly reduces the amount of sent data when the sender and receiver share many of the same objects in common. The default is --thin.
      默认情况下 git push 会在向服务器推送时进行优化,以将所发送的包降低到最小. 做法是发送时忽略本地仓库和远端仓库中共有的部分. 即 git push 默认是采用 --thin 选项的.
      发生本文中出现的问题,貌似是因为某个 git 对象和服务器不一致了.
      这时加上 --no-thin 参数,把该传的都传过去,问题就解决了。
      用这种方式,基本就可以解决。

    2. 另一种解释:
      I am getting this same error on my tortiuse git. I finally get the root cause of this error.
      The steps which causes this error;
      Create a new branch on head.
      Do some modifications on new branchs
      Somebody also make modifications on head branch
      Try to push your branch
      This error will occur if a local branch is created and not pushed until some modifications ara made in head branch. This is a normal thing, since remote head branch do not know anything about your local branch until a push action.
      To solve this error, switch the head branch get a full pull action. Then switch your branch and try a push.
      这个错误出现的场景是:创建一个本地分支,在这个分支上做一些改动,别人在head分支做了改动,尝试然后提交本地分支的改动。出现这个错误提示是正常的事情,因为远程分支并不知道当前分支做了什么,只有在提交时才知道。因此解决的方法是,切换到本地head分支,git pull 拉下最新的改动,然后切换到自己的分支,再做提交。
      个人感觉这个解释是从根本上解释了,但是我没有完全明白,欢迎指教交流。

    参考:
    https://stackoverflow.com/questions/7236738/how-can-i-recover-my-git-repository-for-a-missing-tree-error

    http://blog.csdn.net/liuxu0703/article/details/54289873

    相关文章

      网友评论

          本文标题:git error Missing tree

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