gpt4 book ai didi

node.js - npm 安装在多域 git 存储库上失败

转载 作者:太空宇宙 更新时间:2023-11-04 00:50:03 25 4
gpt4 key购买 nike

我们有一个新项目,并将其托管在我们自己的 Gitlab 服务器中。我克隆了它

git@git.myacme.com:webapplication/app.git

成功。

假设我在 gitlab 中的用户名是 scott@myacme.com。

我们在 Github 上也有一个现有项目,我使用的用户名是 scott@yahoo.com

在新项目中,package.json 中有一个条目指向现有项目。记下 https

https://github.com/myacme/system-application.git

现在,当我执行 npm install 时,它尝试 pull github.com 中的现有项目时失败。它说用户名或密码无效......身份验证失败。我认为它仍在使用 scott@myacme.com 而不是 scott@yahoo.com

我不允许更改 package.json。我正在考虑将其更改为 git 链接而不是 https,但我会影响其他开发人员。如果我这样做,我认为它将使用我在 .ssh/config 中放入的设置。我添加了 2 个主机,我们的 myacme.com 和 github.com

解决这个问题的方法是什么?我已经尝试使用我的雅虎电子邮件地址设置 git config global user.name 和 user.email 但它仍然没有使用它。我没有主意了。

这是 npm-debug.log 文件中的确切错误

515 error git clone --template=/Users/scott/.npm/_git-remotes/_templates --mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: remote: Invalid username or password.

515 error git clone --template=/Users/scott/.npm/_git-remotes/_templates --mirror https://github.com/myacme/system-application.git /Users/scott/.npm/_git-remotes/https-github-com-myacme-system-application-git-0be15bdd: fatal: Authentication failed for 'https://github.com/myacme/system-application.git/'

最佳答案

user.name 不用于 https 身份验证,仅在提交时使用(用于作者/提交者名称)

你能做的是:

这样,git 克隆 将在 GitHub 上使用已知的身份验证(您的 GitHub scott 帐户,因为它具有正确的 ssh 公钥)。

关于node.js - npm 安装在多域 git 存储库上失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33029485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com