Can't install from private GitHub repository #1272

Closed
felixge opened this Issue Aug 16, 2011 · 14 comments

Comments

Projects
None yet
5 participants
@felixge
Contributor

felixge commented Aug 16, 2011

It seems like the new install from git url feature introduced by #1225 does not work for private GitHub urls.

Example: https://gist.github.com/1148641

The problem seems to be that the user name in the url is not parsed correctly and mistaken to be the hostname.

I've tried a few variations on the url, but so far I was unable to come up with one that works for private repositories.

-fg

@isaacs

This comment has been minimized.

Show comment
Hide comment
@isaacs

isaacs Aug 16, 2011

Member

Ah, yeah, the @ is throwing it off, since "@" is the character used to separate the name from the version. That's a bug.

Member

isaacs commented Aug 16, 2011

Ah, yeah, the @ is throwing it off, since "@" is the character used to separate the name from the version. That's a bug.

@felixge

This comment has been minimized.

Show comment
Hide comment
@felixge

felixge Aug 17, 2011

Contributor

If you can give me a quick pointer on where this needs to be fixed, I'd love to contribute a patch. I really want this to work : )

Contributor

felixge commented Aug 17, 2011

If you can give me a quick pointer on where this needs to be fixed, I'd love to contribute a patch. I really want this to work : )

thejh added a commit to thejh/npm that referenced this issue Aug 17, 2011

@thejh

This comment has been minimized.

Show comment
Hide comment
@thejh

thejh Aug 17, 2011

Contributor

@felixge, could you try that fix?

Contributor

thejh commented Aug 17, 2011

@felixge, could you try that fix?

@isaacs isaacs closed this in 10efacb Aug 17, 2011

@isaacs

This comment has been minimized.

Show comment
Hide comment
@isaacs

isaacs Aug 17, 2011

Member

@thejh That's not going to work, though, because it also has to support stuff like npm install foo@special-tag

Member

isaacs commented Aug 17, 2011

@thejh That's not going to work, though, because it also has to support stuff like npm install foo@special-tag

@isaacs

This comment has been minimized.

Show comment
Hide comment
@isaacs

isaacs Aug 17, 2011

Member

These work now:

  • npm install git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
  • npm install sax@git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
  • npm install git+https://isaacs@github.com/isaacs/sax-js.git#cae7b6fb8c
  • Or putting git+(blah) urls as the value in package.json dependency hash.
Member

isaacs commented Aug 17, 2011

These work now:

  • npm install git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
  • npm install sax@git+ssh://git@github.com:isaacs/sax-js.git#cae7b6fb8c
  • npm install git+https://isaacs@github.com/isaacs/sax-js.git#cae7b6fb8c
  • Or putting git+(blah) urls as the value in package.json dependency hash.
@thejh

This comment has been minimized.

Show comment
Hide comment
@thejh

thejh Aug 17, 2011

Contributor

isaacs, wouldn't that be foo@x.y.z-foobar or so?

Contributor

thejh commented Aug 17, 2011

isaacs, wouldn't that be foo@x.y.z-foobar or so?

@isaacs

This comment has been minimized.

Show comment
Hide comment
@isaacs

isaacs Aug 17, 2011

Member

@thejh No. npm install sax@latest for example.

Member

isaacs commented Aug 17, 2011

@thejh No. npm install sax@latest for example.

@thejh

This comment has been minimized.

Show comment
Hide comment
@thejh

thejh Aug 17, 2011

Contributor

mhm, ok

Contributor

thejh commented Aug 17, 2011

mhm, ok

@felixge

This comment has been minimized.

Show comment
Hide comment
@felixge

felixge Aug 17, 2011

Contributor

@isaacs thank you so much! Just tested 10efacb and it works like a charm!

Contributor

felixge commented Aug 17, 2011

@isaacs thank you so much! Just tested 10efacb and it works like a charm!

@vvo

This comment has been minimized.

Show comment
Hide comment
@vvo

vvo Sep 20, 2011

Hello.

Using nodejs 0.4.12.

Since NPM version 1.0.30 (earlier ?), this is not working anymore :

npm install git+ssh://git@github.com:isaacs/sax-js.git

npm ERR! failed git clone ssh://git@github.com:isaacs/sax-js.git
npm ERR! Error: git "clone" "ssh://git@github.com:isaacs/sax-js.git" "/var/folders/8A/8AsLZQW-F1GsmLrEXQx0YE+++TM/-Tmp-/npm-1316510040065/1316510040065-0.6834454846102744" failed with 128
npm ERR! at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! at ChildProcess.emit (events.js:67:17)
npm ERR! at ChildProcess.onexit (child_process.js:192:12)
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git+ssh://git@github.com:isaacs/sax-js.git"
npm ERR! cwd /private/tmp
npm ERR! node -v v0.4.12
npm ERR! npm -v 1.0.30

vvo commented Sep 20, 2011

Hello.

Using nodejs 0.4.12.

Since NPM version 1.0.30 (earlier ?), this is not working anymore :

npm install git+ssh://git@github.com:isaacs/sax-js.git

npm ERR! failed git clone ssh://git@github.com:isaacs/sax-js.git
npm ERR! Error: git "clone" "ssh://git@github.com:isaacs/sax-js.git" "/var/folders/8A/8AsLZQW-F1GsmLrEXQx0YE+++TM/-Tmp-/npm-1316510040065/1316510040065-0.6834454846102744" failed with 128
npm ERR! at ChildProcess. (/usr/local/lib/node_modules/npm/lib/utils/exec.js:49:20)
npm ERR! at ChildProcess.emit (events.js:67:17)
npm ERR! at ChildProcess.onexit (child_process.js:192:12)
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! npm-@googlegroups.com
npm ERR!
npm ERR! System Darwin 10.8.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "git+ssh://git@github.com:isaacs/sax-js.git"
npm ERR! cwd /private/tmp
npm ERR! node -v v0.4.12
npm ERR! npm -v 1.0.30

@ehaselwanter

This comment has been minimized.

Show comment
Hide comment
@ehaselwanter

ehaselwanter Sep 21, 2011

this works just with 1.0.27. just tested with 1.0.28,1.0.29,1.0.30

this works just with 1.0.27. just tested with 1.0.28,1.0.29,1.0.30

@isaacs

This comment has been minimized.

Show comment
Hide comment
@isaacs

isaacs Sep 21, 2011

Member

Ah, the issue is with the ssh urls including the : to delimit the host from the path. Since ssh is the git default transport if it has an "scp-like" url, just stripping off the ssh:// is probably best.

Member

isaacs commented Sep 21, 2011

Ah, the issue is with the ssh urls including the : to delimit the host from the path. Since ssh is the git default transport if it has an "scp-like" url, just stripping off the ssh:// is probably best.

@ehaselwanter

This comment has been minimized.

Show comment
Hide comment
@ehaselwanter

ehaselwanter Sep 22, 2011

no and yes. the problem lies within the : but not in the protocol, but in the protocol AND the path which is the way to express the url of private github repos:

taken from http://help.github.com/remotes/ section clone:

"For public repos you own or are a collaborator on, and all private repos, you must use a private ssh url like git@github.com:user/repo.git. You can find each of the URLs available to you in the header of the repo page:"

with npm 1.0.30

just the 'public' git url do work:

npm install git://github.com/isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

the private or read/write url does not work

npm install git+ssh://git@github.com:isaacs/sax-js.git

npm ERR! failed git clone ssh://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "ssh://git@github.com:isaacs/sax-js.git"

$ npm install git://git@github.com:isaacs/sax-js.git
npm ERR! failed git clone git://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "git://git@github.com:isaacs/sax-js.git"

$ npm install git@github.com:isaacs/sax-js.git
npm ERR! Error: Not found: git@'github.com:isaacs/sax-js.git'
npm ERR! Valid install targets:
npm ERR! ["stable","latest","0.1.0","0.1.1","0.1.2","0.1.3"]

but npm 1.0.27 does the right thing:

$ npm install git+ssh://git@github.com:isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

and it does work with the public url:

$ npm install git://github.com/isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

the other variants fail here too:

$ npm install git://git@github.com:isaacs/sax-js.git
npm ERR! failed git clone git://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "git://git@github.com:isaacs/sax-js.git"

$ npm install git@github.com:isaacs/sax-js.git
npm ERR! Error: Not found: git@'github.com:isaacs/sax-js.git'
npm ERR! Valid install targets:
npm ERR! ["stable","latest","0.1.0","0.1.1","0.1.2","0.1.3"]

no and yes. the problem lies within the : but not in the protocol, but in the protocol AND the path which is the way to express the url of private github repos:

taken from http://help.github.com/remotes/ section clone:

"For public repos you own or are a collaborator on, and all private repos, you must use a private ssh url like git@github.com:user/repo.git. You can find each of the URLs available to you in the header of the repo page:"

with npm 1.0.30

just the 'public' git url do work:

npm install git://github.com/isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

the private or read/write url does not work

npm install git+ssh://git@github.com:isaacs/sax-js.git

npm ERR! failed git clone ssh://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "ssh://git@github.com:isaacs/sax-js.git"

$ npm install git://git@github.com:isaacs/sax-js.git
npm ERR! failed git clone git://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "git://git@github.com:isaacs/sax-js.git"

$ npm install git@github.com:isaacs/sax-js.git
npm ERR! Error: Not found: git@'github.com:isaacs/sax-js.git'
npm ERR! Valid install targets:
npm ERR! ["stable","latest","0.1.0","0.1.1","0.1.2","0.1.3"]

but npm 1.0.27 does the right thing:

$ npm install git+ssh://git@github.com:isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

and it does work with the public url:

$ npm install git://github.com/isaacs/sax-js.git
sax@0.2.4 ./node_modules/sax

the other variants fail here too:

$ npm install git://git@github.com:isaacs/sax-js.git
npm ERR! failed git clone git://git@github.com:isaacs/sax-js.git
npm ERR! Error: `git "clone" "git://git@github.com:isaacs/sax-js.git"

$ npm install git@github.com:isaacs/sax-js.git
npm ERR! Error: Not found: git@'github.com:isaacs/sax-js.git'
npm ERR! Valid install targets:
npm ERR! ["stable","latest","0.1.0","0.1.1","0.1.2","0.1.3"]

@ehaselwanter

This comment has been minimized.

Show comment
Hide comment
@ehaselwanter

ehaselwanter Sep 22, 2011

ah, just saw a new commit about that. so this is fixed in the upcoming 1.0.31 ?

ah, just saw a new commit about that. so this is fixed in the upcoming 1.0.31 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment