'git clone ...' 可以工作,但不能 'pip install ...' 用于同一个遥控器 url
'git clone ...' works but not 'pip install ...' for the same remote url
我想通过 pipenv 或 pip + virtualenv 从私有的、ssh 访问的远程存储库安装一个包。
克隆工作时:
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 的几种变体,如下所示:
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
它们都会产生上面给出的相同错误。
我在这里做错了什么?
ssh://git@remoteurl:username/package.git
这种 URL 的语法是错误的。
Git 理解 SSH URL 的两种语法:
user@host:path/to/repo.git
ssh://user@host/path/to/repo.git
所以,尝试:
$ pip install git+ssh://git@remoteurl/username/package.git
我想通过 pipenv 或 pip + virtualenv 从私有的、ssh 访问的远程存储库安装一个包。 克隆工作时:
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 的几种变体,如下所示:
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
它们都会产生上面给出的相同错误。 我在这里做错了什么?
ssh://git@remoteurl:username/package.git
这种 URL 的语法是错误的。
Git 理解 SSH URL 的两种语法:
user@host:path/to/repo.git
ssh://user@host/path/to/repo.git
所以,尝试:
$ pip install git+ssh://git@remoteurl/username/package.git