VsCode to Github connection when Git is manually configured.

VsCode to Github connection when Git is manually configured.

SSL Cert path error when trying to push code to github from Vscode using Git

Table of contents

No heading

No headings in the article.

Problem
When we install git manually in some particular folder in windows other than c drive pre-defined path {C:\Program Files\Git} then when we try to push code from Vscode to GitHub it will throws errors related to cert issue as vscode will try to find the cert in the pre- defined path.
It will throw errors like "fatal: unable to access 'https://github.com/username/reponame.git/': error setting certificate file: C:\Windows\System32\cmd.exe"

Solution

  1. Download the latest version of git from https://git-scm.com/downloads

  2. Install the git while Installing choose the new desired path (D:\Apps\Git)as per your need instead of the default path(C:\Program Files\Git)

  3. While Installing choose Use VsCode as default git editor

  4. Select next in all later steps and Install.

  5. Now if you Init, add, commit, add origin url, push then it will throw error in vscode related to certs path.

  6. Remember to set remote url by using command -> git remote add origin github.com/username/reponame.git

  7. To fix the error find the correct path of the ssl cert in your installation path (D:\Apps\Git\....\ca-bundle.crt).

  8. Most probably the ca-bundle.crt file will be in "D:/Apps/Git/mingw64/etc/ssl/certs/ca-bundle.crt"

  9. Now in the VS code terminal run the below command
    git config --global http.sslCAInfo "D:/Apps/Git/mingw64/etc/ssl/certs/ca-bundle.crt"

  10. Now push git push -u origin main

  11. You will get a pop-up from git to login to github or to give token generated in github to be accessed from vscode.

  12. Now the code is pushed in the github.