pip
auth_error
ai_generated
partial
ERROR: Command errored out with exit status 128: git clone --filter=blob:none '[email protected]:user/private-repo.git' /tmp/pip-req-build-xxxxx stderr: Cloning into '/tmp/pip-req-build-xxxxx'... [email protected]: Permission denied (publickey). fatal: Could not read from remote repository.
ID: pip/git-clone-ssh-key-error
88%Fix Rate
90%Confidence
1Evidence
2024-01-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| pip 24.0 | active | — | — | — |
| Git 2.43 | active | — | — | — |
| Python 3.12 | active | — | — | — |
Root Cause
pip attempts to clone a private Git repository via SSH but the SSH agent lacks the correct private key or the key is not added to the SSH agent, resulting in 'Permission denied (publickey)'.
generic中文
pip 尝试通过 SSH 克隆私有 Git 仓库,但 SSH 代理缺少正确的私钥或密钥未添加到 SSH 代理,导致 '权限被拒绝 (publickey)'。
Official Documentation
https://pip.pypa.io/en/stable/topics/vcs-support/#gitWorkarounds
-
85% success Add the SSH private key to the agent: 'ssh-add ~/.ssh/id_ed25519' (or appropriate key file). Then retry pip install.
Add the SSH private key to the agent: 'ssh-add ~/.ssh/id_ed25519' (or appropriate key file). Then retry pip install.
-
95% success Use HTTPS with personal access token: pip install git+https://<token>@github.com/user/private-repo.git
Use HTTPS with personal access token: pip install git+https://<token>@github.com/user/private-repo.git
-
80% success Configure pip to use SSH with a different key by setting GIT_SSH_COMMAND: 'GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" pip install git+ssh://[email protected]/user/private-repo.git'
Configure pip to use SSH with a different key by setting GIT_SSH_COMMAND: 'GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" pip install git+ssh://[email protected]/user/private-repo.git'
中文步骤
将 SSH 私钥添加到代理:'ssh-add ~/.ssh/id_ed25519'(或相应的密钥文件)。然后重试 pip install。
使用带有个人访问令牌的 HTTPS:pip install git+https://<token>@github.com/user/private-repo.git
通过设置 GIT_SSH_COMMAND 配置 pip 使用不同的 SSH 密钥:'GIT_SSH_COMMAND="ssh -i ~/.ssh/custom_key" pip install git+ssh://[email protected]/user/private-repo.git'
Dead Ends
Common approaches that don't work:
-
98% fail
Running 'pip install --upgrade pip' does not affect SSH key authentication; the error is in Git, not pip.
-
99% fail
Setting PIP_REQUIRE_VIRTUALENV has no effect on Git authentication.
-
60% fail
Using 'git config --global url."https://github.com/".insteadOf "[email protected]:"' may work for public repos but fails for private repos that need SSH key auth.