ERROR pip auth_error ai_generated true

错误:命令以退出状态 128 出错:git clone --filter=blob:none '[email protected]:user/private-repo.git' /tmp/pip-req-build-xxxxx。请查看日志以获取完整命令输出。权限被拒绝(公钥)。

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

其他格式: JSON · Markdown 中文 · English
85%修复率
90%置信度
1证据数
2023-03-01首次发现

版本兼容性

版本状态引入弃用备注
pip 22.3 active
pip 23.0 active
pip 23.2 active
git 2.30 active
git 2.40 active

根因分析

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

English

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

官方文档

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

解决方案

  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

无效尝试

常见但无效的做法:

  1. 70% 失败

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

  2. 100% 失败

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

  3. 100% 失败

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