是否可以使用pip从私人github存储库安装软件包? [英] Is it possible to use pip to install a package from a private github repository?
问题描述
pip install git + git://github.com/ django / django.git
但是,如果我尝试使用私人存储库:
pip install git + git://github.com/echweb/echweb-utils.git
我得到以下输出:
下载/解包git + git://github.com/echweb/echweb-utils.git
克隆Git存储库git://github.com/echweb/echweb-utils.git到/ var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-VRsIoo-build
完成命令/ usr / local / bin / git的输出git://github.com/echweb/echweb-utils.git / var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-VRsIoo-build:
致命:远程端意外挂起
克隆到/ var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-VRsIoo-build ...
----------------------------- -----------
命令/ usr / local / bin / git clone git://github.com/echweb/echweb-utils.git / var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-VRsIoo-build失败,错误代码为128
我想这是因为我试图在不提供任何身份验证的情况下访问私有存储库。因此,我尝试使用git + ssh,希望pip能够使用我的ssh公钥来验证: //github.com/echweb/echweb-utils.git
这会给出以下输出:
下载/解压缩git + ssh://github.com/echweb/echweb-utils.git
克隆Git仓库ssh ://github.com/echweb/echweb-utils.git到/ var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-DQB8s4-build
从命令/ usr / local / bin / git clone ssh://github.com/echweb/echweb-utils.git / var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-DQB8s4-build:
克隆到/ var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-DQB8s4-build ...
权限被拒绝(publickey)。
致命:远端意外挂断
-------------------------- --------------
命令/ usr / local / bin / git克隆ssh://github.com/echweb/echweb-utils.git / var / folders / cB / cB85g9P7HM4jcPn7nrvWRU +++ TI / -Tmp- / pip-DQB8s4-build失败,错误代码为128
任何人都知道我想要达到甚至可能吗?如果是的话,你可以告诉我怎么做? $ c> URI scheme,但你必须设置用户名:
pip install git + ssh://git@github.com/ echweb / echweb-utils.git
请参阅 git @
部分转换为URI?
另请参阅部署密钥。
PPS:在我的安装中,git + sshURI方案仅适用于可编辑要求:
pip install -e URI#egg = EggName
$ b 记住:更改:
字符, git remote - 在
打印到 pip
命令中使用远程地址之前,v /
字符:
$ git remote -v $ b $ origin git@github.com:echweb / echweb-utils.git(fetch)
^将其更改为一个'/'字符
如果您忘记了,会出现这个错误:
ssh:无法解析主机名github.com:echweb:
节点名或服务名已提供或未知
As the title suggests I am trying to install a python package from a private github repo. For a public repository I can issue the following command which works fine:
pip install git+git://github.com/django/django.git
However if I try this for a private repository:
pip install git+git://github.com/echweb/echweb-utils.git
I get the following output:
Downloading/unpacking git+git://github.com/echweb/echweb-utils.git
Cloning Git repository git://github.com/echweb/echweb-utils.git to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build
Complete output from command /usr/local/bin/git clone git://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build:
fatal: The remote end hung up unexpectedly
Cloning into /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build...
----------------------------------------
Command /usr/local/bin/git clone git://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build failed with error code 128
I guess this is because I am trying to access a private repository without providing any authentication. I therefore tried to use git+ssh hoping that pip would use my ssh public key to authenticate:
pip install git+ssh://github.com/echweb/echweb-utils.git
This gives the following output:
Downloading/unpacking git+ssh://github.com/echweb/echweb-utils.git
Cloning Git repository ssh://github.com/echweb/echweb-utils.git to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build
Complete output from command /usr/local/bin/git clone ssh://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build:
Cloning into /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build...
Permission denied (publickey).
fatal: The remote end hung up unexpectedly
----------------------------------------
Command /usr/local/bin/git clone ssh://github.com/echweb/echweb-utils.git /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build failed with error code 128
Does anyone know if it what I am trying to achieve is even possible? If so can you please tell me how?
You can use git+ssh
URI scheme, but you MUST set username:
pip install git+ssh://git@github.com/echweb/echweb-utils.git
See git@
part into URI?
PS: Also read about deploy keys.
PPS: In my installation the "git+ssh" URI scheme works only with "editable" requirements:
pip install -e URI#egg=EggName
Remember: Change the :
character that git remote -v
prints to a /
character before using the remote's address in the pip
command:
$ git remote -v
origin git@github.com:echweb/echweb-utils.git (fetch)
^ change this to a '/' character
If you forget, you will get this error:
ssh: Could not resolve hostname github.com:echweb:
nodename nor servname provided, or not known
这篇关于是否可以使用pip从私人github存储库安装软件包?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!