简体   繁体   English

npm 从 git 安装使用 https 代替 Z1787D7646304C5D987ZCF4E64A3973DC7

[英]npm install from git use https instead ssh

I have an application with the following package.json file我有一个带有以下 package.json 文件的应用程序

"dependencies": {
    "package_name": "git+ssh://git@git.scm.domain.com:Domain/package_name.git",
}

I can't change it and I can't use ssh.我无法更改它,也无法使用 ssh。 I tried我试过了

git config --global url.https://.insteadOf git://
git config --global url.https://git.scm.domain.com.insteadOf git://git.scm.domain.com

But npm i still throws an error about permission and I see that the url doesn't contain https protocol.但是npm i仍然抛出关于权限的错误,我看到 url 不包含 https 协议。

npm ERR! Error while executing:
npm ERR! path to git.exe ls-remote -h -t git@git.scm.domain.com:Domain/repo.git

Is it possible to setup git or npm to use https instead of ssh while installing deps from package.json? Is it possible to setup git or npm to use https instead of ssh while installing deps from package.json?

git config --global url."https://github.com/".insteadOf git@github.com:
git config --global url."https://".insteadOf git://

This works perfectly.这完美地工作。 Also pay attention to the colon at the end of the first line.还要注意第一行末尾冒号

git config --global url."https://".insteadOf ssh://

This one worked for me.这个对我有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM