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.
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
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!
Thanks Doug! This solved my problem!!!
LikeLike
Awesome! I’m glad this list helped you out!
LikeLike
This is pretty clear. I have been googling about this. None was more clear. This seems correct root cause and solution.
LikeLike
Awesome! I’m glad you found this post helpful!
LikeLike
stucked on this since few days and here I am! Thanks a ton Doug 🙂
LikeLiked by 1 person
Awesome! Glad this blog post helped!
LikeLike
Man, it worked for me, too!
I had the same error “Unable to get local issuer certificate.” and, by running the “git config –global http.sslBackend schannel” from inside the VS Code terminal, the error message disappeared.
Thank you!
LikeLiked by 1 person
this is such a savior! thank you!
LikeLiked by 1 person
Worked like a charm . Thank you for your time to write about it .
LikeLiked by 1 person
Worked like a Charm . Thank you for your time to write about this .
LikeLiked by 1 person
Thank you! It helped
LikeLiked by 1 person
Thank you so much man was facing similar problem.
LikeLiked by 1 person
Thank you so much for that! I was having an error like that: fatal: unable to access ‘https:URL’: SSL certificate problem: self signed certificate in certificate chain and reinstalling Git using this option: “Use the native Windows Secure Channel Library” solved the problem!
Thank you again!
LikeLiked by 1 person