NPM install git repo 失败,因为它使用我的 mac 用户名而不是 'git'

NPM install git repo fails because it uses my mac username instead of 'git'

我正在尝试从私人仓库安装一些东西,我是 运行:

npm i git+ssh://git.remoterepo.net/somerepo.git

我在 ~/.ssh/id_rsa 有一个没有密码的 SSH 密钥,它是在我的远程 git 存储库 (gitlab) 中配置的。

然而每次它提示我:

[MAC_USER]@git.remoterepo.net's password:

它应该使用 git@git.remoterepo.net(git 用户名)。如果我使用 git 用户名进行 SSH,那么我可以登录:

ssh git@git.remoterepo.net

但是如果我这样做 ssh [MAC_USER]@git.remoterepo.net 然后它会提示我输入密码但不能。我已经尝试 npm i git@git+ssh://git.remoterepo.net/somerepo.git 但它仍然使用错误的用户名..

如何让 npm install 使用 git 用户名而不是我的 mac 登录名?

我也试过 HTTPS 但没有成功(挂起或给出 401 未授权)。

谢谢!

尝试使用 npm i git+ssh://git@git.remoterepo.net/somerepo.git

https://docs.npmjs.com/cli/install

中搜索 git@