We are using GitLab for our private project. There are some forked libraries from github, that we want to install as npm module. Installing that module directly from npm is ok and for example this:
npm install git://github.com/FredyC/grunt-stylus-sprite.git
...works correctly too, but doing the same for GitLab, just changing domain gets me this error.
npm WARN `git config --get remote.origin.url` returned wrong result (git://git.domain.com/library/grunt-stylus-sprite.git)
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git Cloning into bare repository 'D:\users\Fredy\AppData\Roaming\npm-cache\_git-remotes\git-git-domain-com-library-grunt-stylus-sprite-git-6f33bc59'...
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git fatal:unable to connect to git.domain.com:
npm ERR! git clone git://git.domain.com/library/grunt-stylus-sprite.git git.domain.com[0: 77.93.195.214]: errno=No error
npm ERR! Error: Command failed: Cloning into bare repository 'D:\users\Fredy\App
Data\Roaming\npm-cache\_git-remotes\git-git-domain-com-library-grunt-stylus-spr
ite-git-6f33bc59'...
npm ERR! fatal: unable to connect to git.domain.com:
npm ERR! git.domain.com[0: xx.xx.xx.xx]: errno=No error
From the web interface of GitLab, I have this URL
git@git.domain.com:library/grunt-stylus-sprite.git
. Running this against npm install
it tries to install git
module from npm registry.
However using URL: git+ssh@git.domain.com:library/grunt-stylus-sprite.git
is suddenly asking me for the password. My SSH key doesn't include passphrase, so I assume it wasn't able to load that key. Maybe there is some configuration for that I have missed ? Key is located at standard location in my home directory with the name "id_rsa"
.
I am on Windows 7 x64.
UPDATE
Since NPM v3 there is built-in support for GitLab and other sources (BitBucket, Gist), from where you can install packages. It works for public and private ones so it's not exactly related to this, but some might find it useful.
npm install gitlab:<gitlabname>/<gitlabrepo>[#<commit-ish>]
Check out documentation: https://docs.npmjs.com/cli/install
I you want to work with private repos in Gitlab you are required to manage your credentials/auth-token in your .npmrc
. See here: https://docs.gitlab.com/ee/user/packages/npm_registry/#authenticate-to-the-package-registry