npm 安装在多域 git 存储库上失败
npm install failing on multi domain git repository
我们有一个新项目,我们将其托管在我们自己的 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 link 而不是 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 身份验证,仅在提交时使用(对于 author/committer 名称)
您可以做的是:
对于 GitHub 存储库,使用 ssh 而不是 https(不更改源中的任何内容)。
参见“”
git config --global url.ssh://git@github.com/.insteadOf https://github.com/
在该 GitHub 存储库(或至少 in your GitHub account)上注册您的 public ssh 密钥
这样,git clone
将在 GitHub(您的 GitHub scott
帐户上使用已知身份验证,因为它有正确的 ssh public 密钥)。
我们有一个新项目,我们将其托管在我们自己的 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 link 而不是 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 身份验证,仅在提交时使用(对于 author/committer 名称)
您可以做的是:
对于 GitHub 存储库,使用 ssh 而不是 https(不更改源中的任何内容)。
参见“”git config --global url.ssh://git@github.com/.insteadOf https://github.com/
在该 GitHub 存储库(或至少 in your GitHub account)上注册您的 public ssh 密钥
这样,git clone
将在 GitHub(您的 GitHub scott
帐户上使用已知身份验证,因为它有正确的 ssh public 密钥)。