簡體   English   中英

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鏈接而不是https,但會影響其他開發人員。 如果這樣做,我認為它將使用我在.ssh / config中設置的設置。 我添加了2個主機,我們的myacme.com和github.com

解決方法是什么? 我嘗試使用yahoo電子郵件地址設置git config全局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 clone將在GitHub(您的GitHub scott帳戶,因為它具有正確的ssh公鑰)上使用已知的身份驗證。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM