Fix git "object not found" forever

From one click to the next, each git pull on the server ends with this:

 $ git pull remote: Counting objects: 53, done. remote: Compressing objects: 100% (32/32), done. remote: Total 32 (delta 19), reused 0 (delta 0) Unpacking objects: 100% (32/32), done. error: unable to find 71682baccff823caa21420b16dd231c6b9c1b133 fatal: object 71682baccff823caa21420b16dd231c6b9c1b133 not found 

Same thing with git fetch . I could solve this problem in one motion by copying the .git/object/71/682baccff823caa21420b16dd231c6b9c1b133 to the server, but after several attempts, the error was still there, each time with the newest commit object on the branch.

How can this happen? And how can I fix it forever?

A full git clone not a good solution, as this repository is in a running server project and has more files without git control.

Is it possible to clone into a new directory and then copy the .git directory to the old folder? Or is there another solution without touching the directories?

+4
source share
3 answers

I could solve the problem with

  • Try to get (with error)
  • Copy the object file as above
  • git merge with committing the missing object file.

Now, apparently, the problem is solved, the error no longer appears.

0
source

I am launching a development team with a corrupt git repository since we have not had time to fix it yet. I found that some things keep the ball in motion, which may help.

First you have one machine with [gc] auto = 0 and unzip all the repo objects

Secondly, git 1.8 seems to handle problems better than 1.7, so you have a machine with git 1.8 with access to file systems containing the source.

Thirdly, always git fetch from machine 1.8, and then git pull from machine 1.7

Fourth, when even 1.8 cannot pull git, you need to run git fsck | grep missing and manually copy the objects from the unpacked repo to the repository of objects on the damaged repo (where 0c0ef24 is missing ... will be in / 0c / 0ef24 objects ...)

It’s a mystery for me why git fetch / pull doesn’t understand that they are not in the local git and get them from the source, but it seems to manually fetch it, after which git is happy again. After you manually installed the git repo run git gc operation (but not on the unpacked computer or you will need to find the missing objects before you can manually fix the situation again, which is annoying)

Which would be very convenient - this is a command to tell git to get a specific object from the source, but I think it would be even better if he did this without having to ask :-)

Hope this helps.

0
source

Today I ran into this problem when trying to git pull centos 6 out of a block using git 1.7.1. The problem was resolved after I upgraded the git client to version 1.7.11 from rpmforge-extras.

0
source

Source: https://habr.com/ru/post/1468802/


All Articles