修复损坏的远程git存储库

时间:2016-09-02 14:51:21

标签: git github

我试图从已损坏的远程git存储库中提取。我该如何解决这个问题?

我运行git pull时遇到的错误是:

$ git pull
remote: Counting objects: 100, done.
remote: error: Out of memory, malloc failed (tried to allocate 422578177 bytes)
remote: error: failed to read object c981f6efdc396e1f38e8988ed8a662aa17fbd4ac at offset 31666554 from ./objects/pack/pack-4d39c620e9d04a0b28132d583ebc7e5b4a73dbd7.pack
remote: fatal: packed object c981f6efdc396e1f38e8988ed8a662aa17fbd4ac (stored in ./objects/pack/pack-4d39c620e9d04a0b28132d583ebc7e5b4a73dbd7.pack) is corrupt
error: git upload-pack: git-pack-objects died with error.
fatal: git upload-pack: aborting due to possible repository corruption on the remote side.
remote: aborting due to possible repository corruption on the remote side.
fatal: protocol error: bad pack header

但是,我假设因为遥控器已损坏,我找不到建议路径./objects/pack/中的文件。该文件夹的内容为:

~/data/CS/CScode/CSCode/.git/objects/pack$ ls
pack-2c19194d1129038c9cd78ece15a08f3fcfeb41aa.idx
pack-2c19194d1129038c9cd78ece15a08f3fcfeb41aa.pack
pack-672e4acc705431911510c1313b9bb0ac0107f4a1.idx
pack-672e4acc705431911510c1313b9bb0ac0107f4a1.pack
pack-8b78dcb33a9466c9d7350dd5781461706d8d24b2.idx
pack-8b78dcb33a9466c9d7350dd5781461706d8d24b2.pack
pack-afde4e3e6f874b4e0dc56cb655472959f6e2328d.idx
pack-afde4e3e6f874b4e0dc56cb655472959f6e2328d.pack
pack-ec1b21f51c4310d0c285ff9686cbd930fba44ee4.idx
pack-ec1b21f51c4310d0c285ff9686cbd930fba44ee4.pack
pack-f16413c010288ecb3902c44c2609824507b7a6de.idx
pack-f16413c010288ecb3902c44c2609824507b7a6de.pack

正在运行git fsck --full

$ git fsck --full
Checking object directories: 100% (256/256), done.
Checking objects: 100% (8053/8053), done.
dangling blob c4c37e81f0bb77bdb0150a0433348cc6fa9d7296
dangling blob ac873825bfb76c3b76c1dca1efa7480381debce4
dangling blob 5fd01ea19b37d06fb43b5a8d142370fccc88b466
dangling blob 94e83d030e49b8892c5ba95f3aa5e812245f538d
dangling blob 1badfde3b7581891399bd7884b0d76979bbcbcfe
dangling blob 3aaefed303f2d9237cc2ba68e17d1e8ffc2608db

1 个答案:

答案 0 :(得分:0)

尝试一下:

$ git fsck --full --no-dangling
Checking object directories: 100% (256/256), done.
Checking objects: 100% (11098/11098), done.

http://brito.blog.incolume.com.br/2020/06/git-packed-object-is-corrupt.html