# 致命错误：参数 'HEAD' 有歧义：未知的修订版本或路径不在工作树中。

- **ID:** `git/ambiguous-argument-revision`
- **领域:** git
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

仓库为空（没有提交）或 HEAD 无效，导致 Git 无法将 'HEAD' 解析为修订版本。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.20 | active | — | — |
| git 2.30 | active | — | — |
| git 2.45 | active | — | — |

## 解决方案

1. ```
   If the repository is empty, make an initial commit: git add . && git commit -m 'Initial commit'. This creates a valid HEAD.
   ```
2. ```
   If HEAD is corrupted, reset it to a known state: git symbolic-ref HEAD refs/heads/main (if main branch exists) or reinitialize the repository: git init (backup data first).
   ```

## 无效尝试

- **** — The error is about HEAD not being resolvable, not about a missing branch; checkout will fail with a different error. (80% 失败率)
- **** — These commands may also fail with the same error if HEAD is invalid; they don't fix the underlying issue. (70% 失败率)
