# 错误：命令以退出状态 128 失败：git clone --filter=blob:none 'git@github.com:user/private-repo.git' /tmp/pip-install-xxxx 请查看日志获取完整命令输出。

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

## 根因

pip 尝试通过 SSH 克隆私有 Git 仓库，但用户未配置正确的 SSH 密钥，或者仓库 URL 不正确。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| pip 21.3 | active | — | — |
| pip 23.0 | active | — | — |
| pip 24.0 | active | — | — |

## 解决方案

1. ```
   确保 SSH 密钥已添加到 ssh-agent：`eval "$(ssh-agent -s)" && ssh-add ~/.ssh/id_rsa` 然后用 `ssh -T git@github.com` 测试
   ```
2. ```
   使用个人访问令牌通过 HTTPS：`pip install git+https://<token>@github.com/user/private-repo.git`
   ```
3. ```
   先手动克隆仓库，然后从本地路径安装：`git clone git@github.com:user/private-repo.git && pip install ./private-repo`
   ```

## 无效尝试

- **Re-run pip with --verbose to see more details, assuming it will fix the issue.** — Verbose output only shows more log lines; it does not resolve authentication issues. (95% 失败率)
- **Delete the /tmp/pip-install-xxxx directory and retry.** — The error is due to SSH authentication, not a stale cache directory. (90% 失败率)
- **Use `pip install git+https://github.com/user/private-repo.git` without checking SSH.** — HTTPS also requires authentication (password or token) unless the repo is public. (70% 失败率)
