简体   繁体   English

GIT Packfile 声称拥有更多对象,无法访问

[英]GIT Packfile claims to have more objects, inaccessable

I am running into multiple errors about my packfile that seem pretty insidious, this is a pretty scary deal since this is a live site and am not sure how to handle it, maybe someone can talk me through it, here's whats going on.我遇到了多个关于我的包文件的错误,这些错误看起来很阴险,这是一个非常可怕的交易,因为这是一个实时站点,我不确定如何处理它,也许有人可以告诉我,这是怎么回事。

It seems that I have a missing object, and also the count of my packfile is bad?好像我有一个丢失的对象,而且我的包文件的计数也不好?

remote: Counting objects: 25733, done.
remote: Compressing objects: 100% (12458/12458), done.
remote: Total 19185 (delta 6914), reused 17995 (delta 6535)

Receiving objects: 100% (19185/19185), 1.69 GiB | 465 KiB/s, done.
Resolving deltas: 100% (6914/6914), completed with 1058 local objects.

error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack claims to have 19185 objects while index indicates 20243 objects
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack cannot be accessed
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack claims to have 19185 objects while index indicates 20243 objects
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack cannot be accessed
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack claims to have 19185 objects while index indicates 20243 objects
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack cannot be accessed

error: unable to find e17196d88ae91dea07b4d61716b91dac581fb131

error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack claims to have 19185 objects while index indicates 20243 objects
error: packfile .git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack cannot be accessed

fatal: object e17196d88ae91dea07b4d61716b91dac581fb131 not found

EDIT Another one seems to have sprouted up, so now I have ....编辑另一个似乎已经发芽了,所以现在我......

.git/objects/pack/pack-1f0643b00b9c201338b7f1365ef188ef682a6a9e.pack 
.git/objects/pack/pack-931e28ca404e28040a10085dd1534ef12cf18c6d.pack

I've tried copying those both up past www-root, and removing them, and am now running git-gc and am going to try refetching origin with git fetch origin我已经尝试将它们都复制到 www-root 之后,然后删除它们,现在我正在运行git-gc并且我将尝试使用git fetch origin

git-gc now returns git-gc现在返回

bad sha1 file: .git/objects/05/.a2e1939ce5a53d5ec7c3cacc4df97acd09c6af.hdgIVe
bad sha1 file: .git/objects/80/.1a75684e9d869e9ed7c1ded674c55caa17c524.YUr1Yu
bad sha1 file: .git/objects/8c/.7e8381b3e0d0a1f1d4fa328f0dda0a1dbd814a.L0255H
bad sha1 file: .git/objects/c5/.32926ac2d67785cb8580b885ac3d3fd7075f57.rDsW4H
Removing stale temporary file .git/objects/pack/tmp_pack_jnP5qn

As mentioned in " Problems with corrupt git repo ", and its associated discussion :正如“ git repo 损坏的问题”及其相关讨论中所述

Many of these objects are then packed together into a packfile to save space.然后将其中的许多对象打包到一个打包文件中以节省空间。 You corrupted these packfiles by changing their content – even worse: changing the length of their content.你通过改变它们的内容来破坏这些包文件——更糟糕的是:改变它们内容的长度。
git fsck does not actually fix anything about a git repository, it just checks for errors and reports them . git fsck实际上并没有修复任何关于 git 存储库的问题,它只是检查错误并报告它们
git unpack-objects on the other hand is able to unpack as much as possible from a corrupted packfile, but you will still have errors in your repo, as git fsck --full will report.另一方面, git unpack-objects能够从损坏的包文件中尽可能多地解包,但是您的存储库中仍然会出现错误,因为git fsck --full会报告。
See " How to fix a broken repository? " or " How to remove all broken refs from a repository? ".请参阅“ 如何修复损坏的存储库? ”或“如何从存储库中删除所有损坏的引用? ”。


Note that with Git 2.4.3 (June 2015), there is no more warning packfile .git/objects/pack/pack-xxx.pack cannot be accessed .请注意,对于 Git 2.4.3(2015 年 6 月),不再有警告packfile .git/objects/pack/pack-xxx.pack cannot be accessed
That allows to focus on the actual errors only.这允许只关注实际错误。

See commit 319b678 [31 Mar 2015] by Jeff King ( peff ) .请参阅Jeff King ( peff ) 的commit 319b678 [31 Mar 2015]。
(Merged by Junio C Hamano -- gitster -- in commit 3c91e99 , 05 Jun 2015) (由Junio C gitster合并-- gitster -- in commit 3c91e99 ,2015 年 6 月 5 日)

As usual with Peff, the explanation is enlightening:和 Peff 一样,这个解释很有启发性:

sha1_file : squelch " packfile cannot be accessed " warnings sha1_file :压制“ packfile cannot be accessed ”警告

When we find an object in a packfile index, we make sure we can still open the packfile itself (or that it is already open), as it might have been deleted by a simultaneous repack.当我们在包文件索引中找到一个对象时,我们确保我们仍然可以打开包文件本身(或者它已经打开),因为它可能已被同时重新打包删除。
If we can't access the packfile, we print a warning for the user and tell the caller that we don't have the object (we can then look in other packfiles, or find a loose version, before giving up).如果我们无法访问包文件,我们会为用户打印一个警告并告诉调用者我们没有该对象(然后我们可以在放弃之前查看其他包文件,或找到一个松散的版本)。

The warning we print to the user isn't really accomplishing anything, and it is potentially confusing to users .我们打印给用户的警告并没有真正完成任何事情,并且可能会让用户感到困惑

In the normal case, it is complete noise;在正常情况下,它是完全的噪音; we find the object elsewhere, and the user does not have to care that we racily saw a packfile index that became stale.我们在别处找到对象,用户不必关心我们是否看到了一个过时的包文件索引。 It didn't affect the operation at all.完全不影响手术。

A possibly more interesting case is when we later can't find the object, and report failure to the user.一个可能更有趣的情况是我们后来找不到对象,并向用户报告失败。 In this case the warning could be considered a clue toward that ultimate failure.在这种情况下,可以将警告视为最终失败的线索。 But it's not really a useful clue in practice.但这在实践中并不是真正有用的线索。 We wouldn't even print it consistently (since we are racing with another process, we might not even see the .idx file, or we might win the race and open the packfile, completing the operation).我们甚至不会一致地打印它(因为我们正在与另一个进程竞争,我们甚至可能看不到.idx文件,或者我们可能会赢得比赛并打开包文件,完成操作)。

This patch drops the warning entirely (not only from the fill_pack_entry site, but also from an identical use in pack-objects ).此补丁完全删除警告(不仅来自fill_pack_entry站点,还来自pack-objects的相同用法)。
If we did find the warning interesting in the error case, we could stuff it away and reveal it to the user when we later die() due to the broken object.如果我们确实发现错误案例中的警告很有趣,我们可以将其填塞并在稍后由于损坏的对象而die()时将其显示给用户。 But that complexity just isn't worth it.但这种复杂性是不值得的。


And with Git 2.22.1 (Q3 2019), " git update-server-info " used to leave stale packfiles in its output, which has been corrected.在 Git 2.22.1(2019 年第三季度)中,“ git update-server-info ”过去常常在其输出中留下陈旧的包文件,这已得到纠正。

See commit e941c48 (23 May 2019) by Eric Wong ( ele828 ) .请参阅Eric Wong ( ele828 ) 提交的 e941c48 (2019 年 5 月 23 日
Helped-by: Jeff King ( peff ) .帮助者: Jeff King ( peff )
(Merged by Junio C Hamano -- gitster -- in commit 776d668 , 25 Jul 2019) (由Junio C gitster合并gitster 提交 776d668,2019年 7 月 25 日)

server-info : do not list unlinked packs server-info :不列出未链接的包

Having non-existent packs in objects/info/packs causes dumb HTTP clients to abort.objects/info/packs packs 中objects/info/packs不存在的包会导致愚蠢的 HTTP 客户端中止。

v2 : use single loop with ALLOC_GROW as suggested by Jeff King v2 :按照 Jeff King 的建议使用带有ALLOC_GROW

Looks like there is some corruption in the other repo.看起来另一个 repo 中存在一些损坏。 If it's a central repo, re-clone it from your repo then have everyone push their branches.如果它是一个中央存储库,请从您的存储库中重新克隆它,然后让每个人推送他们的分支。 Your pull should work after that - unless you can't get the message out that you're fixing the repo to everyone..在那之后你的 pull 应该可以工作 - 除非你不能把你正在修复 repo 给每个人的消息发出来。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM