E001
git
data_error
ai_generated
true
错误:对象文件 .git/objects/ab/cdef1234 为空
error: object file .git/objects/ab/cdef1234 is empty
ID: git/object-corruption-empty-file
80%修复率
85%置信度
1证据数
2025-01-10首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| git 2.38 | active | — | — | — |
| git 2.43 | active | — | — | — |
| git 2.45 | active | — | — | — |
根因分析
由于磁盘损坏、不当关机或手动篡改,仓库中的 git 对象文件为空。
English
A git object file in the repository is empty due to disk corruption, improper shutdown, or manual tampering.
官方文档
https://git-scm.com/docs/git-fsck解决方案
-
Restore the empty object from a backup or remote: git fetch origin refs/heads/main:refs/remotes/origin/main, then git fsck to verify
-
Use git unpack-objects to rebuild objects from pack files if available
-
As a last resort, clone the repo again and cherry-pick uncommitted changes from the broken clone
无效尝试
常见但无效的做法:
-
Delete the empty object file manually
90% 失败
Breaks repository integrity; git will complain about missing objects and may refuse to operate.
-
Run git fsck without fixing first
70% 失败
fsck only reports errors, does not repair; may lead to further confusion.
-
Re-clone the entire repository
40% 失败
Overkill if only one object is corrupt; also loses uncommitted local changes.