【问题标题】:Gitlab error message: remote: HTTP Basic: Access denied fatal: Authentication failed when running npm install on docker-compose buildGitlab错误消息:远程:HTTP基本:访问被拒绝致命:在docker-compose build上运行npm install时身份验证失败
【发布时间】:2021-04-02 11:34:53
【问题描述】:

运行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 容器,但它不起作用。

【问题讨论】:

  • 您是否使用从私有注册表安装的软件包?
  • 抱歉回复晚了。是的,它是一个私人注册表。我已经解决了这个问题会给出更新。谢谢

标签: git docker npm


【解决方案1】:

出现此错误是因为您尝试从私有注册表安装库但尚​​未登录。

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 因素身份验证,则必须输入您的 用户名accesstoken,否则输入您的 密码

【讨论】:

    猜你喜欢
    • 2019-03-26
    • 2023-04-06
    • 2022-07-15
    • 1970-01-01
    • 2016-02-19
    • 2015-07-05
    • 1970-01-01
    • 1970-01-01
    • 2022-01-23
    相关资源
    最近更新 更多