Skip to content
This repository

Can't install from private GitHub repository #1272

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

5 participants

Felix Geisendörfer Isaac Z. Schlueter Jann Horn Vincent Voyer Edmund Haselwanter
Felix Geisendörfer

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

Isaac Z. Schlueter
Owner

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

Felix Geisendörfer

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 : )

Jann Horn thejh referenced this issue from a commit in thejh/npm August 17, 2011
Jann Horn #1272 fix semver so that git-ssh urls work 73bd3aa
Jann Horn

@felixge, could you try that fix?

Isaac Z. Schlueter isaacs closed this in 10efacb August 17, 2011
Isaac Z. Schlueter
Owner

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

Isaac Z. Schlueter
Owner

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.
Jann Horn

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

Isaac Z. Schlueter
Owner

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

Jann Horn

mhm, ok

Felix Geisendörfer

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

Vincent Voyer

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

Edmund Haselwanter

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

Isaac Z. Schlueter
Owner

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.

Edmund Haselwanter

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"]

Edmund Haselwanter

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

Martin Cooper mfncooper referenced this issue from a commit in mfncooper/npm September 21, 2011
Isaac Z. Schlueter Fix #1272 Support 'host:port' for git+ssh urls f461ecd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.