This website uses cookies

Our website, platform and/or any sub domains use cookies to understand how you use our services, and to improve both your experience and our marketing relevance.

📣 Introducing DigitalOceans General Purpose & CPU Optimized Servers on Cloudways Flexible. Learn More

Troubleshooting Git SSL Certificate Issues: A Step-by-Step Guide

Updated on February 18, 2025

5 Min Read
Fix Git SSL Certificate Issues

Troubleshooting Git SSL Certificate Issues: A Step-by-Step Guide If you’ve ever attempted to clone, retrieve, or push to a Git repository and received an SSL certificate issue, you can understand how frustrating it can be. Suddenly, your productivity reduces to a stop, putting you looking at an error message that may be in another language.

Don’t worry, you’re not by yourself! In particular, when working with remote repositories, SSL certificate problems are frequent. The good news is that, with the right information, they can generally be easily fixed. We’ll lead you through the process of debugging Git SSL certificate difficulties step-by-step in this article. This guide is designed for helping developers of all skill levels to get back on track.

Also, you are likely to find that many of these problems are rather simple to resolve with Cloudways Platform and its managed features if you are utilizing it to host your applications. Let’s just get started!

What Are Git SSL Certificate Issues?

You can now see that SSL/TLS certificates are being used to encrypt your connection when you connect to a remote Git repository, like GitHub, GitLab, or maybe a private server. These certificates are used to ensure that you are communicating with the correct server and that your data is completely secured. Git will throw an error, though, if there is a problem with the SSL certificate, such as its expiring, being self-signed, or even not being trusted by your system. Here are some typical and common errors you might encounter:

  • SSL certificate problem: unable to get local issuer certificate
  • SSL certificate problem: self-signed certificate
  • SSL certificate problem: certificate has expired

As previously said, there are several reasons why these mistakes could occur, but we will discuss each of them in this blog post.

Step 1: Check Your Remote Repository URL

Before we begin SSL debugging, let’s make sure that the issue isn’t anything as straightforward as a mistake in the URL of your repository. Now open your terminal or command prompt to run the following command to check your remote URL: git remote -v This command will show you the URLs for fetch and push. So if your URL looks wrong (e.g., it’s pointing to http:// instead of https://), update it using the following command: git remote set-url origin <correct-repo-url> You can replace your repo URL with the example text. This is important because if the URL is incorrect, Git won’t be able to connect to the repository at all, let alone verify the SSL certificate.

git remote -v/pre>

Step 2: Update Your System’s CA Certificates

Now you should know that Git relies on your system’s certificate store to verify SSL certificates. If your certificates are outdated then Git will not trust the remote server’s certificate and eventually you will get an error. Here’s how you can get rid of this issue.

For Windows Users:

You will need to download the latest CA certificates bundle from curl’s official website. Then save the file as ca-bundle.crt in your Git installation directory for instance (C:\Program Files\Git\usr\ssl).

You will have to tell Git to use this new certificate bundle by running the following command:

git config --global http.sslCAinfo "C:/Program Files/Git/usr/ssl/ca-bundle.crt"

For macOS/Linux Users:

You will need to update your system’s CA certificates using your package manager. Here’s how you can do it by using following command:

# For macOS (using Homebrew)

brew install ca-certificates

# For Ubuntu/Debian

sudo apt-get install --reinstall ca-certificates

# For CentOS/RHEL

sudo yum reinstall ca-certificates

Now why does this matter? You see outdated certificates can’t really verify newer SSL certificates, so in order to fix it, we update them to make sure our system can trust the remote server.

Step 3: Temporarily Disable SSL Verification (Use with Caution!)

Now if you are in a hurry and need a quick fix, you can temporarily disable SSL verification. But please be careful, this is not secure and should only be used for testing. You can run the following command to disable SSL verification:

git config --global http.sslVerify false

Once you’re done testing, you will have to re-enable SSL verification by running following command as this is really important to be enabled:

git config --global http.sslVerify true

You see, disabling SSL verification bypasses the certificate check entirely, which can help you identify if the issue is SSL-related or you need to investigate the matter with a different approach. However, it leaves your connection unencrypted, so please don’t use this as a permanent solution.

Step 4: Self Signed Certificates

Another fix can be if you are working with a repository that uses a self-signed certificate (which is quite common in private or internal servers), you will need to explicitly trust the certificate. Here’s how:

You will need to export the Certificate by executing the following command to download the certificate from the server:

openssl s_client -connect <your-git-server>:443 -showcerts </dev/null 2>/dev/null | openssl x509 -outform PEM > git-server-cert.pem

Now you have to replace <your-git-server> with your server’s domain or IP address. You can add the Certificate to Your System’s Trusted Store using following commands:

For macOS/Linux:

sudo cp git-server-cert.pem /usr/local/share/ca-certificates/ sudo update-ca-certificates

For Windows:

Open the Start menu, search for “Manage Computer Certificates,” and import the .pem file into the “Trusted Root Certification Authorities” store. You can tell Git to Use the Certificate by executing the following command:

git config --global http.sslCAinfo /path/to/git-server-cert.pem

This matters because self-signed certificates aren’t trusted by default, so you need to manually add them to your system’s trusted certificates.

Step 5: Check Your System’s Date and Time

SSL certificates are time-sensitive. If your system’s date and time are incorrect, Git might reject valid certificates.

For macOS/Linux:

You can sync your clock using the following command:

sudo ntpdate pool.ntp.org

For Windows:

Open the Date & Time settings and sync your clock with an internet time server. If your system clock is off, it can cause SSL certificates to appear expired or invalid.

Step 6: Simplify Your Workflow with Cloudways

Troubleshooting SSL issues can be time-consuming, but platforms like Cloudways make it easier to manage your applications and deployments. Here’s how Cloudways can help:

  • One-Click Git Deployment: Deploy your repositories without worrying about SSL configurations.
  • Managed SSL Certificates: Automatically generate and renew SSL certificates for your applications.
  • 24/7 Expert Support: Get help from certified professionals whenever you need it.

With Cloudways, you can focus on coding while the platform handles the technical details.

Simplifying Workflows with Cloudways

Host your projects on Cloudways for fast, secure, and scalable performance. Get started today!

Conclusion

Git SSL certificate issues can be a headache, but they’re usually easy to fix once you know what to do. From updating your certificates to trusting self-signed ones, this guide covers all the steps you need to resolve these errors. Remember, while temporary fixes like disabling SSL verification can help, they’re not secure for long-term use. Always aim for a proper solution to keep your connections safe. If you’re looking for a platform that simplifies Git deployments and SSL management, Cloudways is a great choice. With its user-friendly interface and robust features, Cloudways ensures that your development workflow is smooth and efficient. Give it a try today and see the difference for yourself!

Frequently Asked Questions

Q: What causes Git SSL certificate errors?

These errors occur when your system can’t verify the SSL certificate of the remote repository, often due to outdated certificates, misconfigurations, or self-signed certificates.

Q: Is it safe to disable SSL verification in Git?

No, it’s not safe for long-term use as it exposes your connection to security risks. Use it only as a temporary workaround.

Q: How does Cloudways help with Git deployments?

Cloudways offers one-click Git deployment, managed SSL certificates, and 24/7 expert support, making it easier to manage your repositories and applications.

Share your opinion in the comment section. COMMENT NOW

Share This Article

Salwa Mujtaba

Salwa Mujtaba is a Technical Content Writer at Cloudways. With a strong background in Computer Science and prior experience as a team lead in Cloudways Operations, she brings a deep understanding of the Cloudways Platform to her writing. Salwa creates content that simplifies complex concepts, making them accessible and engaging for readers. When she's not writing, you can find her enjoying good music, reading a book, or spending quality time with her family.

×

Webinar: How to Get 100% Scores on Core Web Vitals

Join Joe Williams & Aleksandar Savkovic on 29th of March, 2021.

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Do you like what you read?

Get the Latest Updates

Share Your Feedback

Please insert Content

Thank you for your feedback!

Want to Experience the Cloudways Platform in Its Full Glory?

Take a FREE guided tour of Cloudways and see for yourself how easily you can manage your server & apps on the leading cloud-hosting platform.

Start my tour