VS Code: Fixing Git Certificate Issues

Earlier this year, I started messing around with VS Code as a to see how it compared to the default PowerShell IDE that I’ve been using previously. It’s definitely grown on me, and I’ve been drawn to this whole concept of Git integration, not only for accessing my scripts amongst a variety of systems, but also to collaborate with my colleagues on our company’s internal GitLab site.

In trying to set up Git integration with this internal GitLab site, I kept getting a certificate error that stated: “Unable to get local issuer certificate.” Some of my colleagues didn’t seem to have this issue, and I had followed the same steps as they did during the configuration piece. We looked through a few different configurations and compared settings, but nothing was really jumping out at us.

Now, because Git was pushed to my machine via an internal corporate deployment, I didn’t get to go through all the initial setup screens and what not. In doing some research on the issue, I stumbled upon a post over on StackOverflow regarding this similar issue, and it pointed me in the right direction. Even though one of the posts to ‘just disable SSL verification’ had the most votes, I certainly didn’t want that approach! Further down, a user named Jawad Al Shaikh posted about choosing the SSL transport backend setting during the Git installation as a workaround. Obviously, this would require re-installing Git in my case, but I figured there had to be some other way to reconfigure an existing install of Git.

08-Git-Choosing-HTTPS-transport-backend

I started poking around on my system, and I discovered the corporate settings that were chosen during the initial installation to my machine by opening the file C:\Program Files\Git\etc\install-options.txt. In there, I could see that the HTTPS transport backend setting was set to OpenSSL library (the default). Since I wanted to change this to Windows Secure Channel to see if that did anything, I had to do a little more research. In the end, I think I found two different ways of changing HTTPS transport.

Method one appears to be defined at the user profile level in Windows, as this modifies the .gitconfig file located at C:\Users\<username> (or ~/.gitconfig) In this case, open VS Code, and in the Terminal section, run the following command:

git config --global http.sslBackend schannel

Method two seems to be defined at the Git system level in Windows, as this modifies the gitconfig file located at C:\Program Files\Git\mingw64\etc. In this instance, you’ll have to open VS Code as an administrator before running the following command:

git config --system http.sslBackend schannel

VS Code - SSL Backend.png

In the end, running the git config –global command seems to have resolved my issue, and I can now synchronize scripts and such with our company’s internal GitLab portal. I have a draft started on configuring VS Code to work with Git, and I hope to publish that here very soon. As soon as it’s live, I’ll be sure to share that with the community at large. As always, I hope you found this helpful, and thank you for stopping by!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s