git 整个团队收到“太多无法访问的松散对象”消息
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/37732141/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Whole team gets 'too many unreachable loose objects' messages
提问by jlengrand
Not long ago, we have made the switch from SVN to Git.
不久前,我们已经完成了从 SVN 到 Git 的切换。
A few days ago, I realized that all of our team gets those messages when they push :
几天前,我意识到我们所有的团队在推送时都会收到这些消息:
$ git push
Counting objects: 32, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (19/19), done.
Writing objects: 100% (32/32), 2.94 KiB | 0 bytes/s, done.
Total 32 (delta 14), reused 0 (delta 0)
error: The last gc run reported the following. Please correct the root cause
and remove gc.log.
Automatic cleanup will not be performed until the file is removed.
warning: There are too many unreachable loose objects; run 'git prune' to remove them.
To [email protected]:root/xxx.git
15c3bbb..69e6d8b xxxx -> xxx
I thought it was coming from my computer for a while, until I realize that everybody has the same issues.
有一段时间我以为它来自我的电脑,直到我意识到每个人都有同样的问题。
Needless to say, there is no gc.log in my .git folder, and using 'git gc' or 'git prune' has no effect.
不用说,我的 .git 文件夹中没有 gc.log,使用 'git gc' 或 'git prune' 没有效果。
So my question is : Could it be that the repository hosted on the server is somehow not clean? If so, how to I actually clean it?
所以我的问题是:可能是服务器上托管的存储库不知何故不干净?如果是这样,我该如何清洁它?
All of the solutions I have found so far relate to local copies of repositories.
到目前为止,我发现的所有解决方案都与存储库的本地副本有关。
Also, we use Gitlab to host our repos.
此外,我们使用 Gitlab 来托管我们的存储库。
EDIT : It is worth saying that I have since I posted this question also tried "Housecleaning" the repository using Gitlab but with no result so far.
编辑:值得一提的是,自从我发布这个问题以来,我也尝试过使用 Gitlab“清理”存储库,但到目前为止没有结果。
Thanks
谢谢
采纳答案by VonC
This is followed by issue 14357(GitLab 8.6- or less)
接下来是问题 14357(GitLab 8.6 或更低版本)
The manual fix was:
手动修复是:
- SSH into worker1
- cd into the gitlab-org/gitlab-ce directory
- ran
rm gc.log
, this just contained the line " warning: There are too many unreachable loose objects; run 'git prune' to remove them." - ran
git prune
and prayed it didn't break things (which it thankfully didn't)
- SSH 到 worker1
- cd 进入 gitlab-org/gitlab-ce 目录
- 运行
rm gc.log
,这仅包含“警告:有太多无法访问的松散对象;运行 'git prune' 以删除它们。” - 跑
git prune
并祈祷它没有破坏东西(幸运的是它没有)
But it looks like, starting GitLab 8.7, auto gc is disabled.
This is also done in the context of (still opened) issue 13524:
但看起来,从 GitLab 8.7 开始,auto gc is disabled。
这也是在(仍然打开)问题 13524的上下文中完成的:
Typically after a rebase, amend or other action that requires a force push we can have dangled commits.
Such "dereferenced" commits are getting lost due to
git gc
that may be executed internally or by using GitLab Housekeeping features.If it happens that there was a discussion attached to a specific commit - it is not available after dereferenced commit has been garbage-collected.
Commits are being recorded in push events and are available through system notes added to merge request, and currently this produces error 500 in GitLab.
通常在 rebase、修改或其他需要强制推送的操作之后,我们可能会挂起提交。
由于
git gc
可能在内部执行或使用 GitLab 内务管理功能,此类“取消引用”提交正在丢失。如果碰巧有一个附加到特定提交的讨论 - 在取消引用的提交被垃圾收集后它不可用。
提交记录在推送事件中,可通过添加到合并请求的系统注释获得,目前这会在 GitLab 中产生错误 500。
Update: that issue was closed a month later (July 2016) with:
更新:该问题在一个月后(2016 年 7 月)关闭:
- MR 5062: Don't garbage collect commits that have related DB records like comments
- MR 5062:不要垃圾收集具有相关数据库记录(如评论)的提交
Makes sure a commit is kept around when Git garbage collection runs.
Git GC will delete commits from the repository that are no longer in any branches or tags, but we want to keep some of these commits around, for example if they have comments or CI builds.
确保在 Git 垃圾收集运行时保留提交。
Git GC 将从存储库中删除不再位于任何分支或标签中的提交,但我们希望保留其中一些提交,例如,如果它们有评论或 CI 构建。
- MR 4101: Refactor: Convert existing array-based diff refs to the DiffRefs model
- MR 4101:重构:将现有的基于数组的 diff refs 转换为 DiffRefs 模型