ERROR
pip
install_error
ai_generated
partial
错误:VCS 安装未找到要检出的分支或标签。仓库 'https://github.com/user/repo.git' 没有分支或标签。
ERROR: VCS install did not find a branch or tag to checkout. The repository at 'https://github.com/user/repo.git' has no branches or tags.
ID: pip/vcs-install-no-branch-tag
75%修复率
82%置信度
1证据数
2023-08-22首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| pip 23.1 | active | — | — | — |
| pip 23.2 | active | — | — | — |
| pip 24.0 | active | — | — | — |
根因分析
在 pip VCS 需求中指定的 Git 仓库(例如 git+https://...)为空或没有提交、分支或标签,因此 pip 无法确定要检出的修订版本。
English
A Git repository specified in a pip VCS requirement (e.g., git+https://...) is empty or has no commits, branches, or tags, so pip cannot determine which revision to checkout.
官方文档
https://pip.pypa.io/en/stable/topics/vcs-support/解决方案
-
初始化仓库至少包含一个提交和一个分支:git init; git add .; git commit -m 'initial'; git branch -M main; git push -u origin main
-
使用本地路径安装代替 VCS:pip install /path/to/local/repo
-
显式指定提交哈希:pip install git+https://github.com/user/repo.git@abc123def456
无效尝试
常见但无效的做法:
-
70% 失败
Pip cannot checkout a branch that does not exist in the remote repository.
-
40% 失败
Local path installs work, but the error is about VCS specifically; the workaround requires using a local path correctly.