# 错误：VCS 安装未找到要检出的分支或标签。仓库 'https://github.com/user/repo.git' 没有分支或标签。

- **ID:** `pip/vcs-install-no-branch-tag`
- **领域:** pip
- **类别:** install_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 75%

## 根因

在 pip VCS 需求中指定的 Git 仓库（例如 git+https://...）为空或没有提交、分支或标签，因此 pip 无法确定要检出的修订版本。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 23.1 | active | — | — |
| pip 23.2 | active | — | — |
| pip 24.0 | active | — | — |

## 解决方案

1. ```
   初始化仓库至少包含一个提交和一个分支：git init; git add .; git commit -m 'initial'; git branch -M main; git push -u origin main
   ```
2. ```
   使用本地路径安装代替 VCS：pip install /path/to/local/repo
   ```
3. ```
   显式指定提交哈希：pip install git+https://github.com/user/repo.git@abc123def456
   ```

## 无效尝试

- **** — Pip cannot checkout a branch that does not exist in the remote repository. (70% 失败率)
- **** — Local path installs work, but the error is about VCS specifically; the workaround requires using a local path correctly. (40% 失败率)
