ERROR pip install_error ai_generated partial

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

Also available as: JSON · Markdown · 中文
75%Fix Rate
82%Confidence
1Evidence
2023-08-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 23.1 active
pip 23.2 active
pip 24.0 active

Root Cause

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.

generic

中文

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

Official Documentation

https://pip.pypa.io/en/stable/topics/vcs-support/

Workarounds

  1. 85% success Initialize the repository with at least one commit and a branch: git init; git add .; git commit -m 'initial'; git branch -M main; git push -u origin main
    Initialize the repository with at least one commit and a branch: git init; git add .; git commit -m 'initial'; git branch -M main; git push -u origin main
  2. 90% success Use a local path install instead of VCS: pip install /path/to/local/repo
    Use a local path install instead of VCS: pip install /path/to/local/repo
  3. 80% success Specify a commit hash explicitly with @: pip install git+https://github.com/user/repo.git@abc123def456
    Specify a commit hash explicitly with @: pip install git+https://github.com/user/repo.git@abc123def456

中文步骤

  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

Dead Ends

Common approaches that don't work:

  1. 70% fail

    Pip cannot checkout a branch that does not exist in the remote repository.

  2. 40% fail

    Local path installs work, but the error is about VCS specifically; the workaround requires using a local path correctly.