[英]Gitlab error message: remote: HTTP Basic: Access denied fatal: Authentication failed when running npm install on docker-compose build
运行sudo docker-compose build
时收到错误消息
在我的 Dockerfile 里面,它正在运行:
RUN npm install
错误消息说:
npm ERR! Error while executing:
npm ERR! /usr/bin/git ls-remote -h -t https://git.mycompany.com/path_public/speakeasy.git
npm ERR!
npm ERR! remote: HTTP Basic: Access denied
npm ERR! fatal: Authentication failed for 'https://git.mycompany.com/path_public/speakeasy.git/'
npm ERR!
npm ERR! exited with error code: 128
我不明白为什么运行npm install
需要 git 凭据。
我尝试使用docker cp
将我的本地 git 凭据复制到 docker 容器,但它不起作用。
发生此错误是因为您尝试从私有注册表安装库但尚未登录。
1. 让您的 git repo 记住您的登录: (15 分钟)
运行git config --global credential.helper cache
2.复制并粘贴上面显示的命令,在您的情况下:
/usr/bin/git ls-remote -h -t https://git.mycompany.com/path_public/speakeasy.git
这将要求您提供凭据。 如果您使用 2-factor-authentication,则必须输入您的username和accesstoken ,否则输入您的password 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.