问题
In my package.json I have private repo called somerepo.git. Now I am running an npm install on a buildserver(bamboo) through maven and getting this error:
[ERROR] npm ERR! Command failed: git clone --template=/var/home/ci/.npm/_git-remotes/_templates --mirror https://somerepo.git
[ERROR] npm ERR! fatal: Authentication failed for https://somerepo.git
How can I resolve the authentication for the repository?
回答1:
If you can, you should:
- access the private repo through ssh
- use a deploy or trusted key that you register to your Git remote hosting server, in order to allow your CI server to access it.
- configure your .ssh/config file in order for npm to use the right key: see "Is there a way to specify which ssh key should be used for npm install"
来源:https://stackoverflow.com/questions/44224567/how-to-resolve-authentication-error-in-npm-install