Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone familiar with the git error "missing object 0000000000000000000000000000000000000000 for refs/heads/..."?

Tags:

git

gitweb

We are running git v1.7.1 and have gitweb configured. We also use gitolite for administration, but I do not believe that is germane to this issue. From time to time we get an error in the Apache log like:

missing object 0000000000000000000000000000000000000000 for refs/heads/...

Where the elipse at the end is typically a branch name. I believe that the string of zeros is suppost to be a SHA1 value. Obviously, all zeros is not a SHA1 value. It is not clear to me where this value is comming from?

I have run git fsck on the server and it did not report an issue, however git gc resolves the problem. Also, we are able to pull and push to this repository (and that branch) fine. Only gitweb appears to be effected.

I know others have seen this issue becuase there is a closed question about it here: Gitweb failure: fatal: missing object 0000000000000000000000000000000000000000 for refs/heads/master There is no answer to that question.

Additional Information

We have now seen this isssue on our gitolite-admin repository. We do not have branches in our gitolite-admin repository, so this was not on a branch.

like image 591
Pat O Avatar asked May 25 '11 21:05

Pat O


People also ask

Why do some Git refs fail to push?

A commit gets rejected and causes a failed to push some refs to error because the remote branch contains code that you do not have locally. What this means is that your local git repository is not compatible with the remote origin. Here is an abstraction of what incompatibility looks like in Git:

What are the most common errors in Git?

This is one of the most common errors, especially for newcomers to Git. Let’s suppose that you want to run git status in a particular directory: The error indicates that the command cannot be executed because the current directory is not a Git directory. Usually, there are two main reasons why you might be getting the error.

Why am I getting a Git error when creating a branch?

This error occures because it might possible that there is a branch with the same name already exist, or there is a branch is already created with the same name pattern. Git Error: error: cannot lock ref "refs/heads/ABC-1001/xyz": "refs/heads/ABC-1001 exists; cannot create "refs/heads/ABC-1001/xyz"

Why am I getting ‘Master (fetch first) ’ error in Git?

You got a ‘master (fetch first)’ error with a ‘failed to push some refs to’ error When this occurs, someone has pushed to the branch before you. Git wants you to pull first before you can push your committed changes.


3 Answers

This error occurred for me after the default branch on the remote was changed and the former default branch was deleted. My local repository still had a reference to the deleted branch in

.git\refs\remotes\origin\HEAD

I simply updated this to reference the new default remote.

like image 161
The Rover Avatar answered Oct 09 '22 20:10

The Rover


Check the umask value of the user running git-daemon. Setting it to 022 may help you (look at 'man umask').

like image 37
Ouranos Avatar answered Oct 09 '22 22:10

Ouranos


I have also found a similar issue locally for one of my projects. For me the behaviour is the following:

  • on git fetch i get error: refs/heads/test_theme does not point to a valid object!
  • on git branch i get fatal: missing object 97fe4dfaa2bfb3768f42bb5caca1c7cd37a26734 for refs/heads/test_theme

I can't really say I remember what I did with that branch and when. Sorry.

However, the error goes away when I do rm -rf /path/to/project/.git/refs/heads/test_theme.

like image 2
Lpgfmk Avatar answered Oct 09 '22 22:10

Lpgfmk