How to fix a bad git tree object

前端 未结 4 1277
情话喂你
情话喂你 2020-12-16 11:46

I have a local copy of a repository that not longer have any remote associated to it. I\'m trying to push this repo into a new remote however everytime I get this message: <

相关标签:
4条回答
  • 2020-12-16 12:25

    Just Quit the applcation with which you accessing git and restart . Worked for me for xcode-iOS.

    0 讨论(0)
  • 2020-12-16 12:34

    I have my git repo in a directory which is also in the OneDrive folder on my computer. If you use OneDrive on another machine, push from the repo on that computer and then pull/push from your own machine again.

    0 讨论(0)
  • 2020-12-16 12:37

    I had this problem. Restarting my computer actually fixed it so please try it first before doing anything else. Or maybe I just got lucky but worth a shot!

    0 讨论(0)
  • 2020-12-16 12:47

    To actually fix the problem and not lose any data (provided that that tree is the only missing object, which I doubt) you could try this:

    1. checkout the parent commit of the commit with the concerning tree
    2. try git cat-file -p with the name of the problematic commit to see what the commit message says (hopefully it will tell you what changed)
    3. now you might be able to determine the changes that were made and from this the directory structure can hopefully be inferred.
    4. if 3 worked, then you can create your tree manually using a text editor and a zlib compressor. The entries in the tee file will be other tree objects or blobs. Hopefully most of the files and folders are shared (have no changes) between the two commits. This will allow you to reuse most of the entries from the tree object of the checked out commit.
    0 讨论(0)
提交回复
热议问题