简体   繁体   中英

Trouble installing private github repository using pip

To preface, I have already seen this question Is it possible to use pip to install a package from a private github repository?

I am trying to install a package from a private repository that I have access to using pip.

I am able to directly clone it like so:

(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.

But when I try to install it via pip (my virtualenv is activated):

(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

I tried typing in my password but it failed. However I am ssh authenticated for git@github.com:

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

I can switch git@github.com to robpodosek@github.com and it lets me install via pip just fine:

(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...

However I want to do what the first mentioned article does by using git@github.com so that I don't have to add my username into a requirements.txt file and add that to version control.

Any thoughts? I previously had this working but had to boot up a fresh image. Thanks ahead of time.

它通过使用 oxyum 的建议将其更改为:

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

Make sure you use github.com /account instead of github.com :account see Git+SSH dependencies have subtle (yet critical) differences from git clone

Had virtualenv activated and had to install a series of applications from github.com from a text file.

(venv)$ cat requirements.txt
-e git://github.com/boto/botocore.git@develop#egg=botocore
-e git://github.com/boto/jmespath.git@develop#egg=jmespath
-e git://github.com/boto/s3transfer.git@develop#egg=s3transfer
nose==1.3.3
mock==1.3.0
wheel==0.24.0
unittest2==0.5.1; python_version == '2.6'

(venv)$ pip install -r requirements.txt
Ignoring unittest2: markers 'python_version == "2.6"' don't match your environment Obtaining botocore from git+git://github.com/boto/botocore.git@develop#egg=botocore (from -r requirements.txt (line 1))
Cloning git://github.com/boto/botocore.git (to develop) to ./venv/src/botocore
fatal: unable to connect to github.com:
github.com[0: 192.30.253.112]: errno=Connection timed out
github.com[1: 192.30.253.113]: errno=Connection timed out

Command "git clone -q git://github.com/boto/botocore.git 
/home/ubuntu/utils/boto3/venv/src/botocore" failed with error code 128 in None

However, as @Robeezy suggested, edited the requirement.txt and changed from

-e git://github.com...

to

-e git+https://github.com...

That is the link provided if you were to clone from the site (only options were Clone or Download).

So, thank you! It did work finally.

If you're installing with pip install git+https://github.com/repo and getting this error, make sure your username and password are correct. I was getting this error because I was incorrectly entering my password.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM