I have an application with the following package.json file
"dependencies": {
"package_name": "git+ssh://[email protected]:Domain/package_name.git",
}
I can't change it and I can't use 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 ERR! Error while executing:
npm ERR! path to git.exe ls-remote -h -t [email protected]:Domain/repo.git
Is it possible to setup git or npm to use https instead of ssh while installing deps from package.json?
While SSH is usually considered more secure, for basic usage of Github, HTTPS authentication with a password is acceptable enough. In fact, Github themselves defaults to and recommends most people use HTTPS.
npm has accepted HTTPS or HTTP requests for some time. (In fact, only the initial hop from your client to Fastly, our CDN, would use HTTP.) We returned most data to you via HTTPS, but we would serve JSON containing package metadata over HTTP if you requested it via HTTP.
[BUG] NPM v7 uses SSH instead of an explicit HTTPS for GitHub repos #2610.
git config --global url."https://github.com/".insteadOf [email protected]:
git config --global url."https://".insteadOf git://
This works perfectly. Also pay attention to the colon at the end of the first line.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With