Reputation: 21564
I have a git repo on a personal server, which uses a self-signed certificate.
What I'd like to do is to add this CA to npm's trusted one(s), in order to install packages from repo like this:
npm install git+https://domain.tld/repo.git
The following commands allowed me to trust my server, but after that, my local npm does not trust npm.org repo anymore.
npm config set cafile=/usr/local/share/ca-certificates/domain.tld/ca.crt
npm config set ca="content-of-my-cert"
NB: It works well with git+ssh://
but as other people will consume this package, I don't want to add a new trusted ssh key every time there's a new consumer...
Upvotes: 0
Views: 3734
Reputation: 3012
Your setting of the cafile and ca is wiping out the default trusted CA certs. You can trust multiple CA certs using an array of ca[] like this:
npm config set ca[]="content_of_your_CA_cert"
npm config set ca[]="content_of_the_npm_root_cert"
npm config set ca[]="content_of_the_npm_intermediate_cert"
P.S. - npm.org is National Association of Pastoral Musicians. If you meant npmjs.com, that cert is currently signed by DigiCert using this intermediate cert and this root cert.
Upvotes: 1