gpt4 book ai didi

git - 由于缺少对象,我该如何处理 Git 损坏?

转载 作者:IT王子 更新时间:2023-10-29 00:55:32 26 4
gpt4 key购买 nike

我刚刚去克隆另一台远程服务器上的存储库,但在尝试这样做时遇到了问题:

git clone git@codebasehq.com:blah/blah/docs.git
Cloning into docs...
remote: Counting objects: 343, done.
remote: error: unable to find 14f87a739828e4d489b0310a51e057b30333926e
remote: Compressing objects: 100% (325/325), done.
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: fatal: unable to read 14f87a739828e4d489b0310a51e057b30333926e
remote: aborting due to possible repository corruption on the remote side.
fatal: early EOF
fatal: index-pack failed

我做了一些研究,发现了关于 git fsck 的信息,这里是输出:

$ git fsck --full
error: sha1 mismatch 14f87a739828e4d489b0310a51e057b30333926e

error: 14f87a739828e4d489b0310a51e057b30333926e: object corrupt or missing
missing blob 14f87a739828e4d489b0310a51e057b30333926e

所有其他遇到类似问题的人都有链接断开问题或其他问题。我对 Git 还是很陌生,有人知道如何解决这个问题吗?

我仍然可以推送到我的中央远程存储库,但我无法克隆它。

14f87a739828e4d489b0310a51e057b30333926e 是一个 blob,它是存储库根目录中的 markdown 文件。我尝试删除此文件并推送这些更改无济于事。


编辑:是否可以从另一个仓库导入 git 历史记录?我在想我可以开始一个新的 repo 协议(protocol)并将我的文件复制到其中,然后导入提交历史记录。

最佳答案

如果它只是一个文件并且还没有打包,您应该能够在本地存储库的 .git/objects/14/f87a739828e4d489b0310a51e057b30333926e 中找到它。您可以将此文件复制到您服务器上存储库中的相应目录。

如果它已打包,您应该能够在 .git/objects/pack/ 中的其中一个打包文件上使用 git unpack-objects 将其解包。之后,复制到服务器的工作如上所述。

关于git - 由于缺少对象,我该如何处理 Git 损坏?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4929674/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com