ERROR pip auth_error ai_generated true

ERROR: Command errored out with exit status 128: git clone --filter=blob:none '[email protected]:user/private-repo.git' /tmp/pip-req-build-xxxxx. Check the logs for full command output. Permission denied (publickey).

ID: pip/git-clone-ssh-permission-denied

Also available as: JSON · Markdown · 中文
85%Fix Rate
90%Confidence
1Evidence
2023-03-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
pip 22.3 active
pip 23.0 active
pip 23.2 active
git 2.30 active
git 2.40 active

Root Cause

pip is trying to clone a private Git repository via SSH, but the SSH key is not configured or not accepted by the remote host (e.g., GitHub).

generic

中文

pip 尝试通过 SSH 克隆私有 Git 仓库,但 SSH 密钥未配置或未被远程主机(如 GitHub)接受。

Official Documentation

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

Workarounds

  1. 90% success Ensure SSH key is added to ssh-agent: eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
    Ensure SSH key is added to ssh-agent: eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
  2. 95% success Use a personal access token with HTTPS: pip install git+https://<token>@github.com/user/private-repo.git
    Use a personal access token with HTTPS: pip install git+https://<token>@github.com/user/private-repo.git
  3. 90% success Clone the repo manually first, then install from local: git clone [email protected]:user/private-repo.git && pip install ./private-repo
    Clone the repo manually first, then install from local: git clone [email protected]:user/private-repo.git && pip install ./private-repo

中文步骤

  1. Ensure SSH key is added to ssh-agent: eval $(ssh-agent -s) && ssh-add ~/.ssh/id_rsa
  2. Use a personal access token with HTTPS: pip install git+https://<token>@github.com/user/private-repo.git
  3. Clone the repo manually first, then install from local: git clone [email protected]:user/private-repo.git && pip install ./private-repo

Dead Ends

Common approaches that don't work:

  1. 70% fail

    HTTPS often requires username/password or token, which may not be available in the pip environment; also fails with authentication errors.

  2. 100% fail

    Cache clearing does not affect SSH authentication; the clone will still fail.

  3. 100% fail

    This is equivalent to the original; same SSH key issue persists.