isaacs/npm — Issue #1852: Proposal: `--no-<protocol>` (or at least `--no-git`)
Author: indexzero
Created: 2011-12-08 07:35:17+00:00
State: open

So recently we've ditched git submodules in-favor of `git+ssh://git@....` style protocol syntax in our package.json. To avoid the overhead of additional SSH keys for git pulls on our production boxes also add these to `bundleDependencies`.

e.g.

``` js
{
"dependencies": {
"some-dep": "git+ssh://git@github.com:some-user/some-dep.git"
}
"bundleDependencies": [
"some-dep"
]
}
```

_Potential bug_
When we untar the package we create and run `npm install` npm throws because there is no valid SSH key for the git dependencies. Shouldn't `npm install` not attempt to install the git dependencies because they are on disk?

_Proposed solution / workaround_
We could work around the larger issue here by simply telling npm to ignore git dependencies which I would image would be something like:

``` bash
$ npm install --no-git
```

@isaacs What are your thoughts here? I don't know much about how `nopt` works, but if you're parsing this stuff into `npm.config` it seems like a one-line feature:

Replacing this: https://github.com/isaacs/npm/blob/master/lib/cache.js#L229-236 with the code below would do the trick.

``` js
case "git:":
case "githttp:":
case "githttps:":
case "gitrsync:":
case "gitftp:":
case "gitssh:":
if (npm.config.get('no-git') return addRemoteGit(spec, p, name, cb)
return cb()
```