npm git protocol dependencies

Finally I found a dirty solution, but that works fine. I've modified the code of NPM to replace the git protocol by the http protocol (thanks to opened source)

On npm v1.1.69, into the file npm/lib/cache.js, I've added the following lines to the function addRemoteGit

 // ssh paths that are scp-style urls don't need the ssh://
 if (parsed.pathname.match(/^\/?:/)) {
   u = u.replace(/^ssh:\/\//, "")
 }

 //begin trick
 if(/^git:/.test(u)){
     u = u.replace(/^git/, 'https');
 }
 //end trick

 log.verbose("addRemoteGit", [u, co])

You can tell git to use https instead of git:// with the following command:

git config --global url."https://".insteadOf git://

Tags:

Git

Npm