You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

使用pip通过SSH安装Azure DevOps私有包报错,请求问题分析

使用pip通过SSH安装Azure DevOps私有包的错误分析

已知正常场景

  • 可通过git clone命令,使用SSH或HTTPS协议成功克隆目标仓库
  • 使用pip install "git+https://<repository_https_url>"命令可成功安装包

错误1:使用pip install "git+ssh://<repository_ssh_url>"失败

错误信息

pip install "git+ssh://<repository_ssh_url>"

Collecting git+ssh://****@ssh.dev.azure.com:v3/***/LindeUtils
  Cloning ssh://****@ssh.dev.azure.com:v3/***/LindeUtils to c:\users\****\temp\pip-req-build-_o7f2wcb
  Running command git clone --filter=blob:none --quiet 'ssh://****@ssh.dev.azure.com:v3/***/LindeUtils' 'C:\Users\****\Temp\pip-req-build-_o7f2wcb'
  ssh: Could not resolve hostname ssh.dev.azure.com:v3: Name or service not known
  fatal: Could not read from remote repository.

  Please make sure you have the correct access rights
  and the repository exists.
  error: subprocess-exited-with-error

原因分析

SSH URL格式错误。在ssh://协议的URL中,冒号:用于指定端口号,但你提供的URL里将Azure DevOps仓库路径的/v3写成了:v3,导致SSH客户端把ssh.dev.azure.com:v3当作完整的主机名去解析,而实际不存在这个主机,因此解析失败。

Azure DevOps正确的SSH格式应为:

git+ssh://git@ssh.dev.azure.com/v3/{组织名}/{项目名}/{仓库名}

错误2:使用pip install "git+ssh://<repository_https_url>"失败

错误信息

pip install "git+ssh://<repository_https_url>"

Collecting git+ssh://****@dev.azure.com/***/LindeUtils
  Cloning ssh://****@dev.azure.com/***/LindeUtils to c:\users\****\temp\pip-req-build-a_xjd47o
  Running command git clone --filter=blob:none --quiet 'ssh://****@dev.azure.com/***/LindeUtils' 'C:\Users\****\Temp\pip-req-build-a_xjd47o'
  ssh: connect to host dev.azure.com port 22: Network is unreachable
  fatal: Could not read from remote repository.

  Please make sure you have the correct access rights
  and the repository exists.
  error: subprocess-exited-with-error

原因分析

  1. 主机与端口不匹配:Azure DevOps的SSH服务部署在ssh.dev.azure.com而非dev.azure.com,dev.azure.com默认不监听SSH的22端口,因此无法建立连接。
  2. URL路径格式错误:HTTPS协议的仓库路径与SSH协议的路径结构不同,直接替换协议前缀会导致路径不匹配,无法定位到正确的仓库。

解决建议

使用Azure DevOps官方提供的正确SSH仓库URL,格式如下:

pip install "git+ssh://git@ssh.dev.azure.com/v3/你的组织名/你的项目名/你的仓库名"

内容的提问来源于stack exchange,提问作者DragonFang

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.18 10:04:59