# 致命：损坏的树对象：<哈希>：'<文件名>' 的重复条目

- **ID:** `git/merge-tree-corrupted`
- **领域:** git
- **类别:** data_error
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

Git 对象数据库中的树对象包含同一文件路径的重复条目，表明由于硬件故障、手动操作对象或有漏洞的工具导致仓库损坏。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.37.0 | active | — | — |
| git 2.38.2 | active | — | — |
| git 2.39.1 | active | — | — |

## 解决方案

1. ```
   Run 'git fsck --full' to identify all corrupt objects, then use 'git replace --edit <hash>' to manually remove the duplicate entry from the tree object
   ```
2. ```
   If a remote backup exists, reclone the repository and cherry-pick local commits: 'git clone <remote> new-repo && cd new-repo && git remote add old ../old-repo && git fetch old && git cherry-pick <local-commits>'
   ```

## 无效尝试

- **** — Deleting all objects is extreme and may lose local branches, stashes, or uncommitted work; a reclone should only be done if remote is healthy, but it ignores local-only objects. (40% 失败率)
- **** — git gc may fail or skip corrupt objects without fixing the duplicate entry, and can make the corruption harder to recover by packing objects. (65% 失败率)
