# 错误：命令以退出状态 128 出错：git clone --filter=blob:none 'git@github.com:user/private-repo.git' /tmp/pip-req-build-xxxxx。请查看日志以获取完整命令输出。权限被拒绝（公钥）。

- **ID:** `pip/git-clone-ssh-permission-denied`
- **领域:** pip
- **类别:** auth_error
- **错误码:** `ERROR`
- **验证级别:** ai_generated
- **修复率:** 85%

## 根因

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

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 22.3 | active | — | — |
| pip 23.0 | active | — | — |
| pip 23.2 | active | — | — |
| git 2.30 | active | — | — |
| git 2.40 | active | — | — |

## 解决方案

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 git@github.com:user/private-repo.git && pip install ./private-repo
   ```

## 无效尝试

- **** — HTTPS often requires username/password or token, which may not be available in the pip environment; also fails with authentication errors. (70% 失败率)
- **** — Cache clearing does not affect SSH authentication; the clone will still fail. (100% 失败率)
- **** — This is equivalent to the original; same SSH key issue persists. (100% 失败率)
