对于相同的远程URL,"git clone ..."有效,但"pip install ..."无效 [英] 'git clone ...' works but not 'pip install ...' for the same remote url

查看:293
本文介绍了对于相同的远程URL,"git clone ..."有效,但"pip install ..."无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过pipenv或pip + virtualenv从私有的,通过ssh访问的远程存储库中安装软件包. 克隆有效时:

I want to install a package via pipenv or pip + virtualenv from a private, ssh accessed, remote repository. While cloning works:

git clone git@remoteurl:username/package.git

直接安装不会:

pip install git+ssh://git@remoteurl:username/package.git

并输出以下错误:

ssh: Could not resolve hostname remoteurl:username: Name or service not known
fatal: Could not read from remote repository.

我尝试了pip + virtualenv和pipenv,但均无效. 我还尝试了以下几种url变体:

I tried pip+virtualenv and pipenv, neither works. I also tried several variations of the url like the following:

pip install git@remoteurl:username/package.git

pip install git+git@remoteurl:username/package.git

pip install git+remoteurl:username/package.git

pip install git+ssh://remoteurl:username/package.git

所有这些都产生与上面给出的相同的错误. 我在这里做什么错了?

all of them produce the same error given above. What am I doing wrong here?

推荐答案

ssh://git @ remoteurl:username/package.git

ssh://git@remoteurl:username/package.git

那是那种URL的错误语法.

That's the wrong syntax for that kind of URLs.

Git理解SSH URL的两种语法:

Git understands two syntaxes of SSH URLs:

  • user@host:path/to/repo.git
  • ssh://user@host/path/to/repo.git
  • user@host:path/to/repo.git
  • ssh://user@host/path/to/repo.git

因此,尝试:

$ pip install git+ssh://git@remoteurl/username/package.git

这篇关于对于相同的远程URL,"git clone ..."有效,但"pip install ..."无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆