Explore Courses Blog Tutorials Interview Questions
+1 vote
in DevOps and Agile by (19.4k points)

As the title suggests I am trying to install a Python package from a private GitHub repository. For a public repository I can issue the following command which works fine:

pip install git+git://

However, if I try this for a private repository:

pip install git+git://

I get the following output:

Downloading/unpacking git+git://

Cloning Git repository git:// to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-VRsIoo-build

Complete output from command /usr/local/bin/git clone 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:// /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://

This gives the following output:

Downloading/unpacking git+ssh://

Cloning Git repository ssh:// to /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build

Complete output from command /usr/local/bin/git clone ssh:// /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:// /var/folders/cB/cB85g9P7HM4jcPn7nrvWRU+++TI/-Tmp-/pip-DQB8s4-build failed with error code 128

Is what I am trying to achieve even possible? If so, how can I do it?

1 Answer

0 votes
by (27.5k points)

In order to use git+ssh URI scheme, but you MUST set username:

pip install git+ssh://[email protected]/echweb/echweb-utils.git

See [email protected] part into URI?

PS: Also read about deploy keys.

In case of me the installation the "git+ssh" URI scheme works only with "editable" requirements:

pip install -e URI#egg=EggName

Remember that 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  [email protected]:echweb/echweb-utils.git (fetch)

                      ^ change this to a '/' character

If you forget, you will get this error:

ssh: Could not resolve hostname

         nodename nor servname provided, or not knowan

Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers


94.2k users

Browse Categories