繁体   English   中英

npm 从 git 安装使用 https 代替 Z1787D7646304C5D987ZCF4E64A3973DC7

[英]npm install from git use https instead ssh

我有一个带有以下 package.json 文件的应用程序

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

我无法更改它,也无法使用 ssh。 我试过了

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

但是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?

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

这完美地工作。 还要注意第一行末尾冒号

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

这个对我有用。

暂无
暂无

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

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