# 致命错误：无法递归到子模块路径'subdir/submodule'

- **ID:** `git/submodule-checkout-failed`
- **领域:** git
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

Git无法检出或更新子模块，原因包括子模块URL缺失、网络故障或子模块中存在本地更改。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 2.39.0 | active | — | — |
| 2.40.0 | active | — | — |
| 2.41.0 | active | — | — |

## 解决方案

1. ```
   检查.gitmodules中的子模块URL并验证网络访问：'git config --file .gitmodules submodule.subdir/submodule.url'。然后运行'git submodule sync'和'git submodule update --init --recursive'。
   ```
2. ```
   如果子模块有本地更改，先暂存或提交：'cd subdir/submodule && git stash && cd ../.. && git submodule update --init --recursive'。
   ```

## 无效尝试

- **Running 'git submodule update --init --recursive' multiple times without checking the submodule URL.** — If the submodule URL is wrong or inaccessible, repeating the command won't fix the underlying issue. (70% 失败率)
- **Deleting the submodule directory and re-running 'git submodule update'.** — This may work if the submodule was corrupted, but it doesn't address URL or network issues. (40% 失败率)
- **Manually editing .gitmodules without understanding the submodule dependency.** — Incorrect changes to .gitmodules can break the submodule setup further. (60% 失败率)
