Anyone familiar with the git error “missing object 0000000000000000000000000000000000000000 for refs/heads/…”?

倖福魔咒の 提交于 2019-12-10 01:50:19

问题


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.


回答1:


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.




回答2:


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




回答3:


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.




回答4:


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.




回答5:


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.



来源:https://stackoverflow.com/questions/6131385/anyone-familiar-with-the-git-error-missing-object-00000000000000000000000000000

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!