2

I have a git repository in BitBucket (bitbucket.org) and an on-premise TFS 2015 instance. I want to have a build in the TFS that clones the repository from BitBucket and then builds the code.

In the build job I'm using the "External Git" repository option. I've setup an end point to connect to the BitBucket git repo using the HTTPS URL. I've tried using the username and password in the specified fields and embedding them into the URL.

When I run the build job it fails with the message below.

Starting clone
[error]user cancelled certificate check: 
[error]Prepare repository failed with exception.
Matthew van Boheemen
  • 1,087
  • 3
  • 13
  • 21
  • I managed to get this resolved on one computer, but now I need to do it on another computer and I've forgotten what I did on the first one - yes I know I should have written it down.... So I know it is possible, just looking to understand how I do it. – Matthew van Boheemen May 01 '19 at 04:53

1 Answers1

2

It is similar to libgit2/libgit2sharp issue 1600 (libgit2 being used by TFS 2015)

"User cancelled certificate check" means that there's an untrusted certificate.

You should either use a certificate on your server that is trusted by your system, or provide a certificate hook check to accept it.
Technically speaking, you can also turn off all git's certificate checking, but I don't recommend it.

If the corporate proxy is presenting a self-signed certificate, or one that was not issued with a trusted cert chain. This is common in corporate proxies.

Before disabling anything, check with your Admin if IIS is configured properly, as described in "How can I setup HTTPS with Secure Sockets Layer (SSL) for Team Foundation Server? / Requesting, installing, and configuring websites with a certificate"

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
  • How do I disable this check when I'm using this as part of the TFS Git integration? – Matthew van Boheemen May 01 '19 at 05:12
  • @MatthewvanBoheemen Did you try (on yor first machine) a `git config --system http.sslVerify false`, as in https://github.com/Microsoft/azure-pipelines-agent/issues/677#issuecomment-259703659? – VonC May 01 '19 at 05:14
  • It doesn't appear to have sslVerify disabled on the first machine and I did try that on the second machine as well without success. This was with an external install of git, will the libgit2sharp embedded in the TFS build agent pick up the external git settings? Or do I need to run this in the context of the libgit2sharp somehow? – Matthew van Boheemen May 01 '19 at 06:32
  • @MatthewvanBoheemen It should pick up that setting: https://stackoverflow.com/a/31166973/6309. But do a `git config --global http.sslVerify false` then (since there is no "system" Git), for testing. – VonC May 01 '19 at 06:34