# 致命：在 .gitmodules 中未找到子模块路径 'X' 的 URL

- **ID:** `git/submodule-no-url`
- **领域:** git
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 88%

## 根因

.gitmodules 中定义了子模块，但其 URL 缺失或格式错误，导致克隆和更新操作失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| git 2.34.0 | active | — | — |
| git 2.40.0 | active | — | — |
| git 2.46.0 | active | — | — |

## 解决方案

1. ```
   Edit .gitmodules to add the correct URL: 'git config -f .gitmodules submodule.X.url https://github.com/user/repo.git', then run 'git submodule sync' and 'git submodule update --init'.
   ```
2. ```
   Remove the submodule entry from .gitmodules and .git/config, then re-add it with 'git submodule add <url> <path>'.
   ```

## 无效尝试

- **** — Running 'git submodule update --init --recursive' will still fail if URL is missing. (95% 失败率)
- **** — Deleting the submodule directory and re-adding it without fixing .gitmodules will not help. (80% 失败率)
