gpt4 book ai didi

python - 'git clone .. .' works but not ' pip install ...' 对于相同的远程 url

转载 作者:太空狗 更新时间:2023-10-30 02:53:40 25 4
gpt4 key购买 nike

我想通过 pipenv 或 pip + virtualenv 从私有(private)的、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

关于python - 'git clone .. .' works but not ' pip install ...' 对于相同的远程 url,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48689415/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com