Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'git clone ...' works but not 'pip install ...' for the same remote url

I want to install a package via pipenv or pip + virtualenv from a private, ssh accessed, remote repository. While cloning works:

git clone git@remoteurl:username/package.git

directly installing doesn't:

pip install git+ssh://git@remoteurl:username/package.git

and outputs the following error:

ssh: Could not resolve hostname remoteurl:username: Name or service not known
fatal: Could not read from remote repository.

I tried pip+virtualenv and pipenv, neither works. I also tried several variations of the url like the following:

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

all of them produce the same error given above. What am I doing wrong here?

like image 512
CygnusX1985 Avatar asked Jan 28 '23 17:01

CygnusX1985


1 Answers

ssh://git@remoteurl:username/package.git

That's the wrong syntax for that kind of URLs.

Git understands two syntaxes of SSH URLs:

  • user@host:path/to/repo.git
  • ssh://user@host/path/to/repo.git

So, try:

$ pip install git+ssh://git@remoteurl/username/package.git
like image 167
Vladimir Panteleev Avatar answered Jan 31 '23 07:01

Vladimir Panteleev