【发布时间】:2016-01-06 21:13:01
【问题描述】:
我们有一个新项目,我们将它托管在我们自己的 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 时,它尝试拉取 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/'
【问题讨论】:
标签: node.js git github npm gitlab