git 如何解决 npm install 中的身份验证错误?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44224567/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 12:46:56 来源:igfitidea点击:
How to resolve authentication error in npm install?
提问by bier hier
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:
在我的 package.json 中,我有一个名为 somerepo.git 的私有仓库。现在我通过 maven 在 buildserver(bamboo) 上运行 npm install 并收到此错误:
[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?
如何解决存储库的身份验证?
采纳答案by VonC
If you can, you should:
如果可以,您应该:
- access the private repo through ssh
- use a deploy or trusted keythat 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
"
- 通过 ssh 访问私有仓库
- 使用您注册到 Git 远程托管服务器的部署或可信密钥,以允许您的 CI 服务器访问它。
- 配置您的 .ssh/config 文件,以便 npm 使用正确的密钥:请参阅“是否有办法指定应将哪个 ssh 密钥用于
npm install
”