If you're seeing the error:
depth_zero_self_signed_cert
while using Git on cPanel, it means that Git does not trust the self-signed SSL certificate.
If you just need a temporary workaround, disable SSL verification for Git:
git config --global http.sslVerify false
Warning: This is insecure and should only be used for testing.
To disable SSL verification only for a specific repository, run this inside the repo:
git config --local http.sslVerify false
Test Git again:
git clone https://yourdomain.com/repo.git
If you want a secure solution without disabling SSL verification, manually add the self-signed certificate.
-----BEGIN CERTIFICATE----- to -----END CERTIFICATE-----)ssh youruser@yourdomain.comnano ~/my-self-signed-ca.crtgit config --global http.sslCAInfo ~/my-self-signed-ca.crt
Test Git again:
git clone https://yourdomain.com/repo.git
If it works, your Git now trusts the self-signed SSL certificate!
sudo cp ~/my-self-signed-ca.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates
sudo cp ~/my-self-signed-ca.crt /etc/pki/ca-trust/source/anchors/
sudo update-ca-trust
Restart Git and test again.
| Issue | Fix |
|---|---|
| Temporary Git fix | git config --global http.sslVerify false (!Insecure) |
| Permanent Git fix | git config --global http.sslCAInfo ~/my-self-signed-ca.crt |
| Trust system-wide | Add certificate to /usr/local/share/ca-certificates/ and run update-ca-certificates |
Now Git should work correctly on cPanel with your self-signed SSL certificate!