What can I do with Git corruption due to a missing object?

本秂侑毒 提交于 2019-11-30 18:16:17

If it's only one single file and it's not packed yet, you should be able to find it in .git/objects/14/f87a739828e4d489b0310a51e057b30333926e in your local repository. You can copy this files to the corresponding directory in the repository on your server.

If it is packed, you should be able to unpack it using git unpack-objects on one of the pack files in .git/objects/pack/. After that, copying to the server works as described above.

ssmir

Here is almost the same question with a very detailed solution: Github Repo Corruption - Sha1 Collision

Simple push will not fix this problem, because git sees it has the commit that refers to the corrupt file and will assume it has all the objects it needs.

Do you have another repository with the project that does not report any problems with fsck (and has the file in question)? E.g. on your local machine? Than you should try:

  1. Put the corrupt repository aside.
  2. Clone the good repository in it's place.
  3. Push any branches the old repository had from other repositories or the old repository.

Since this kind of error means the file on disk was corrupt, I suggest you do a thorough check of the filesystem, the disk and also memory (the data could get corrupted in memory when git was saving them).

Note: While all disks have at least some checksums, most memory chips have none at all, so a memory fault is more likely to go undetected than a disk fault. memtest86+ is a good way to check memory.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!