Fix "SSL certificate problem: unable to get local issuer certificate" (git, curl, pip, npm)
SSL certificate problem: unable to get local issuer certificate
- fatal: unable to access 'https://github.com/user/repo.git/': SSL certificate problem: unable to get local issuer certificate
- curl: (60) SSL certificate problem: unable to get local issuer certificate
- ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate
- npm error code UNABLE_TO_GET_ISSUER_CERT_LOCALLY
- SSL certificate problem: self-signed certificate in certificate chain
The tool cannot find, in its certificate store, the authority that signed the server's certificate. In a company, it is almost always a proxy or antivirus inspecting HTTPS with its own root certificate. Add that root certificate to the system or tool store; do not disable SSL verification.
What this error means
To trust an HTTPS server, the client walks the certificate chain up to a root authority present in its local store. "unable to get local issuer certificate" means that walk fails: the issuer of the last certificate received is not in the store. Not every tool uses the system store: Python often relies on certifi, Node.js on its own Mozilla list, Git for Windows on an OpenSSL bundle. That is why the browser works while git, pip or npm fail.
Common causes
- Proxy or antivirus inspecting HTTPS (Zscaler, Netskope, Fortinet, antivirus HTTPS scanning): it re-signs certificates with an internal root the tool does not know.
- Tool with its own store: Python (
certifi), Node.js, Git for Windows or curl built with OpenSSL ignore certificates added to the system by IT. - Outdated store: old
certifi, old system, or Python installed from python.org on macOS without runningInstall Certificates.command. - Incomplete chain on the server: the server does not send the intermediate certificate. Browsers fetch it on their own, command-line tools do not.
- Self-signed certificate on an internal server (GitLab, Nexus, private registry): you must trust that certificate or the internal authority that issued it.
Step-by-step fix
-
Find who signs the certificate
Look at the
issuerof the chain you receive. If it names your company, proxy or antivirus, it is TLS inspection. If the chain stops at a public intermediate certificate, the server is misconfigured: it must serve the full chain.openssl s_client -connect github.com:443 -servername github.com -showcerts </dev/null | grep -E 'subject=|issuer=' curl -v https://pypi.org/simple/ -o /dev/null -
Install the root certificate in the system
Get the root certificate from your IT team, or export it from the browser (top certificate of the chain, Base-64 PEM format). Then add it to the system store. On Windows, your company has often already deployed it.
# macOS sudo security add-trusted-cert -d -r trustRoot -k /Library/Keychains/System.keychain corp-root.pem # Debian / Ubuntu (file must end in .crt) sudo cp corp-root.crt /usr/local/share/ca-certificates/ sudo update-ca-certificates # Fedora / RHEL sudo cp corp-root.pem /etc/pki/ca-trust/source/anchors/ sudo update-ca-trust -
Configure git
On Windows, the simplest option is to make Git use the Windows store (Schannel). Elsewhere, after the previous step, git usually already uses the system store. Otherwise, point it to a bundle: note that
http.sslCAInforeplaces the default bundle, so it must contain the public roots and the company root.# Windows git config --global http.sslBackend schannel # macOS / Linux, if still needed git config --global http.sslCAInfo /path/to/ca-bundle.pem -
Configure Python and pip
Recent pip versions use the system store through
truststore: start by upgrading pip. Forrequests, point to a bundle with an environment variable. On macOS with Python from python.org, runInstall Certificates.commandin the Python folder inside Applications.python -m pip install --upgrade pip certifi pip config set global.cert /path/to/ca-bundle.pem export REQUESTS_CA_BUNDLE=/path/to/ca-bundle.pem export SSL_CERT_FILE=/path/to/ca-bundle.pem -
Make a Python script use the system store
The
truststorepackage makesssl,requestsandurllib3use the system certificate store, the one where your company already installed its root.# pip install truststore requests import truststore truststore.inject_into_ssl() import requests print(requests.get("https://pypi.org/simple/").status_code) -
Configure Node.js and npm
NODE_EXTRA_CA_CERTSadds your root certificate to Node.js's own, without removing the others; it is read when the process starts.npm config set cafilereplaces npm's list, so the file must be a full bundle. Recent Node.js versions also accept--use-system-ca.export NODE_EXTRA_CA_CERTS=/path/to/corp-root.pem npm config set cafile /path/to/ca-bundle.pem # Recent Node.js versions export NODE_OPTIONS=--use-system-ca -
Do not disable SSL verification
git config --global http.sslVerify false,curl -k,npm config set strict-ssl false,NODE_TLS_REJECT_UNAUTHORIZED=0orverify=Falsemake the tool accept any certificate. An attacker on the network can then intercept your credentials and tokens and tamper with the code or packages you download. These global settings stay active and forgotten. If you must test, limit it to a single command, then check withgit config --global --listthat nothing is left behind.
Did this fix work for you?
Confirm it in one click: it will rise for the next developers stuck on the same error.
Keep it from coming back
- Install the company root once in the system store and configure your tools to use it (Schannel,
truststore,--use-system-ca). - Keep
certifi, pip, Node.js and Git up to date so you have recent authority lists. - Never commit
sslVerify false,strict-ssl falseorNODE_TLS_REJECT_UNAUTHORIZED=0in a project, Dockerfile or CI config.
Frequently asked questions
Is git config http.sslVerify false dangerous?
Yes. Git then accepts any certificate and can no longer detect interception: credentials and code can be read or altered. Install the missing root certificate instead.
Why does the site work in the browser but not with git or pip?
The browser uses the system store, where your company installed its root, and fetches missing intermediate certificates on its own. git, pip or npm often use their own list and do not complete the chain.
How is it different from "self-signed certificate in certificate chain"?
In that case the tool did receive the root, but it is self-signed and missing from its store, which also happens with a corporate proxy. The fix is the same: trust that root.
Useful tools for this error
More Systems (Windows, macOS, Linux) errors
- Fix "command not found" and "is not recognized as an internal or external command"
- Fix "running scripts is disabled on this system" in PowerShell
- Fix "xcrun: error: invalid active developer path" on macOS
- Fix "user is not in the sudoers file. This incident will be reported."
- Fix "/bin/bash^M: bad interpreter: No such file or directory"
- Fix "E: Could not get lock /var/lib/dpkg/lock-frontend" (apt, Ubuntu, Debian)
- Fix "App is damaged and can't be opened" on macOS (Gatekeeper)