有人熟悉 git 错误“缺少对象 0000000000000000000000000000000000000000 for refs/heads/...”吗?

发布于 2024-11-09 11:22:53 字数 742 浏览 3 评论 0原文

我们正在运行 git v1.7.1 并配置了 gitweb。我们也使用 gitolite 进行管理,但我不认为这与这个问题有密切关系。有时我们会在 Apache 日志中收到如下错误:

missing object 0000000000000000000000000000000000000000 for refs/heads/...

其中末尾的省略号通常是分支名称。我相信这串零应该是 SHA1 值。显然,全零不是 SHA1 值。我不清楚这个值从哪里来?

我已经在服务器上运行 git fsck 并且没有报告问题,但是 git gc 解决了问题。此外,我们可以很好地拉取和推送到此存储库(以及该分支)。似乎只有 gitweb 受到影响。

我知道其他人已经看到了这个问题,因为这里有一个关于它的封闭问题: Gitweb失败:致命:缺少对象00000000000000000000000000000000 00000000 为 refs/heads/master 这个问题没有答案。

其他信息

我们现在已经在 gitolite-admin 存储库中看到了此问题。我们的 gitolite-admin 存储库中没有分支,因此它不在分支上。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

微暖i 2024-11-16 11:22:53

在更改远程上的默认分支并删除以前的默认分支后,我发生了此错误。我的本地存储库仍然引用了已删除的分支

.git\refs\remotes\origin\HEAD

我只是更新了它以引用新的默认遥控器。

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.

往事随风而去 2024-11-16 11:22:53

检查运行 git-daemon 的用户的 umask 值。将其设置为 022 可能会对您有所帮助(查看“man umask”)。

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

夢归不見 2024-11-16 11:22:53

我在本地的一个项目中也发现了类似的问题。对我来说,行为如下:

  • git fetch 上,我收到 error: refs/heads/test_theme does not point to a valid object!
  • on gitbranch代码>我得到致命:缺少对象97fe4dfaa2bfb3768f42bb5caca1c7cd37a26734 for refs/heads/test_theme

我不能说我真的记得我对那个分支做了什么以及什么时候。对不起。

但是,当我执行 rm -rf /path/to/project/.git/refs/heads/test_theme 时,错误消失了。

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.

云朵有点甜 2024-11-16 11:22:53

这是没有提交的分支的默认设置。当您推送新分支时,您将在输出中看到 00000->ef357 或类似的内容。

它也可能是由区分大小写的内容引起的。

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.

一紙繁鸢 2024-11-16 11:22:53

每当存储库更新并且 Apache 的权限设置不正确时,就会发生这种情况。

我设置了一个脚本挂钩,在每次提交后运行以修复权限(此处的说明 http://sitaramc.github.com/gitolite/hooks.html)。我已将 Apache 添加到 git 组,因此所有文件都必须可由 Apache 运行的 gitweb cgi 读取。我正在考虑使用 suexec 来解决这个问题。

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.

在巴黎塔顶看东京樱花 2024-11-16 11:22:53

我的解决方案是丢弃一些历史记录。
将 git clone 到其他地方。复制 .git/refs 来覆盖坏的。

My solution is discarding some history.
Do git clone to somewhere else. copy .git/refs to overwrite the bad ones.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文