4

We have a new TFS 2017 server set up on-premises. My sysadmin set up https and generated a self-signed certificate. Everything works fine with Visual Studio's built-in git tools. When I try to do anything from the CLI, I get the following error: SSL certificate problem: unable to get local issuer certificate

What I have tried:

  • Installed the certificate in the Trusted Root Certificate Authorities store on my client machine (it is also installed on the server). To install it, I simply double-clicked the .pfx file provided to me, entered the password, and chose the Trusted Root store.

  • After some troubleshooting, I exported the local certificate as a Base-64 encoded x.509 (.CER) file, and appended it to ca-bundle.crt

  • Double-checked my git config to ensure http.sslcainfo is pointed to the correct ca-bundle.crt file.

  • Used openssl to connect to my server. This gives me two error messages: verify error:num=20:unable to get local issuer certificate verify return:1 depth=0 OU = Created by Team Foundation Server, CN = my.company.com verify error:num=21:unable to verify the first certificate verify return:1 Certificate chain 0 s:/OU=Created by Team Foundation Server/CN=my.company.com i:/OU=Created by Team Foundation Server/CN=my.company.com

  • Tried to use the CLI from other machines to connect over https, with the same results.

Update

Still no luck getting this working, but was curious if the fact that the self-signed certificate is signed with a private key would have anything to do with our issues. Self-Signed certificate is signed with a pk

Mike Gasparelli
  • 466
  • 2
  • 8
  • 13
  • 2
    Possible duplicate of [Unable to resolve "unable to get local issuer certificate" using git on Windows with self-signed certificate](http://stackoverflow.com/questions/23885449/unable-to-resolve-unable-to-get-local-issuer-certificate-using-git-on-windows) – Barry Pollard Jan 13 '17 at 21:53
  • 1
    Was finally able to convince my sysadmin to try the suggestion in the linked issue (use makecert to create the certificates) and that solved my problem – Mike Gasparelli Jan 21 '17 at 15:23

2 Answers2

14

It seems your issue is not TFS related, but your self-signed certificate cannot be verified. You can check the solution here:

Workaround

Tell git to not perform the validation of the certificate using the global option:

git config --global http.sslVerify false

Resolution

There are several ways this issue has been resolved previously:

A. Ensure the root cert is added to git.exe's certificate store as discussed here.

B. Tell Git where to find the CA bundle by running:

git config --system http.sslCAPath /absolute/path/to/git/certificates

or copying the CA bundle to the /bin directory and adding the following to the gitconfig file:

sslCAinfo = /bin/curl-ca-bundle.crt

C. Reinstalling Git.

D. Ensuring that the complete CA is present, including the root cert.

After solving the SSL issue, you may refer to the following case just in case you have Authentication issue in command line:

Using Git with TFS 2017 - Works in Visual studio but not Command Line

Jim G.
  • 15,141
  • 22
  • 103
  • 166
Cece Dong - MSFT
  • 29,631
  • 1
  • 24
  • 39
0

In the end, it turns out that it was the certificate that IIS generated that was the problem.

I found the solution on this SO question: Unable to resolve "unable to get local issuer certificate" using git on Windows with self-signed certificate

See the accepted answer for using makecert to generate your server certificate

Mike Gasparelli
  • 466
  • 2
  • 8
  • 13