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.
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.
Check the umask value of the user running git-daemon. Setting it to 022 may help you (look at 'man umask').
This is the default for a branch with no commits. When you push a new branch, you will see in the output 00000->ef357 or something like that.
It could also be caused by case sensitive stuff.
This happens for me whenever a repo gets updated and the permissions are set incorrectly for Apache.
I've set a script hook to run after each commit to fix the permissions (instructions here http://sitaramc.github.com/gitolite/hooks.html). I've added Apache to the git group, and thus all of the files must be readable by the gitweb cgi run by Apache. I am considering using suexec to remedy this.
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
.
My solution is discarding some history.
Do git clone
to somewhere else. copy .git/refs
to overwrite the bad ones.