使用 pip 安装私有 github 存储库时遇到问题

新手上路,请多包涵

作为序言,我已经看过这个问题 Is it possible to use pip to install a package from a private github repository?

我正在尝试从我可以使用 pip 访问的私有存储库安装一个包。

我可以像这样直接克隆它:

 (myenv)robbie@ubuntu:~/git$ git clone git@github.com:matherbk/django-messages.git
Cloning into 'django-messages'...
remote: Counting objects: 913, done.
remote: Compressing objects: 100% (345/345), done.
remote: Total 913 (delta 504), reused 913 (delta 504)
Receiving objects: 100% (913/913), 165.73 KiB, done.
Resolving deltas: 100% (504/504), done.

但是当我尝试通过 pip 安装它时(我的 virtualenv 被激活):

 (myenv)robbie@ubuntu:~/git$ pip install git+https://git@github.com/matherbk/django-messages.gitDownloading/unpacking git+https://git@github.com/matherbk/django-messages.git
  Cloning https://git@github.com/matherbk/django-messages.git to /tmp/pip-13ushS-build
Password for 'https://git@github.com':
fatal: Authentication failed
  Complete output from command /usr/bin/git clone -q https://git@github.com/matherbk/django-messages.git /tmp/pip-13ushS-build:

----------------------------------------
Command /usr/bin/git clone -q https://git@github.com/matherbk/django-messages.git /tmp/pip-13ushS-build failed with error code 128 in None
Storing complete log in /home/robbie/.pip/pip.log

我尝试输入密码,但失败了。但是我通过了 git@github.com 的 ssh 身份验证:

 (myenv)robbie@ubuntu:~/git$ ssh -T git@github.com
Hi robpodosek! You've successfully authenticated, but GitHub does not provide shell access.

我可以切换 git@github.comrobpodosek@github.com 它让我可以通过 pip 安装:

 (myenv)robbie@ubuntu:~/git$ pip install git+https://robpodosek@github.com/matherbk/django-messages.git
Downloading/unpacking git+https://robpodosek@github.com/matherbk/django-messages.git
  Cloning https://robpodosek@github.com/matherbk/django-messages.git to /tmp/pip-SqEan9-build
Password for 'https://robpodosek@github.com':
  Running setup.py egg_info for package from git+https://robpodosek@github.com/matherbk/django-messages.git

    warning: no files found matching 'README'
Installing collected packages: django-messages
  Running setup.py install for django-messages

    warning: no files found matching 'README'
Successfully installed django-messages
Cleaning up...

但是,我想通过使用 git@github.com 来完成第一篇提到的文章所做的事情,这样我就不必将我的用户名添加到 requirements.txt 文件中并将其添加到版本控制中。

有什么想法吗?我以前有这个工作,但不得不启动一个新的形象。提前致谢。

原文由 Robeezy 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 652
2 个回答

它通过使用 oxyum 将 : 更改为 / 的建议来工作:

 pip install git+ssh://git@github.com/matherbk/django-messages.git

原文由 Robeezy 发布,翻译遵循 CC BY-SA 4.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题