libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

LibGit2Sharp.LibGit2SharpException: certificate revocation status could not be verified

Open daneel3001 opened this issue 3 months ago • 0 comments

Hello

I am like many behind a corporate firewall for outbound access. I am using LibGit2Sharp as a dependency of another tool Aspire.PolyRepo.

I am getting this error:

Unhandled exception. LibGit2Sharp.LibGit2SharpException: certificate revocation status could not be verified
   at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154
   at LibGit2Sharp.Core.Ensure.ZeroResult(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 172
   at LibGit2Sharp.Core.Proxy.git_clone(String url, String workdir, GitCloneOptions& opts) in /_/LibGit2Sharp/Core/Proxy.cs:line 278
   at LibGit2Sharp.Repository.Clone(String sourceUrl, String workdirPath, CloneOptions options) in /_/LibGit2Sharp/Repository.cs:line 823

I have tried: git config --global http.sslVerify false

I have as well put the callback for certificate check during clone operations like this:

var co = new CloneOptions();
co.FetchOptions.CertificateCheck += delegate (Certificate certificate, bool valid, string host)
{
    return true;
};

Claude AI was proposing other things like the following to get this to work:

// Set multiple environment variables to bypass SSL verification
Environment.SetEnvironmentVariable("GIT_SSL_NO_VERIFY", "1");
Environment.SetEnvironmentVariable("GIT_SSL_CAINFO", "");
Environment.SetEnvironmentVariable("GIT_CURL_VERBOSE", "1");

// Disable certificate validation globally for .NET HttpClient
ServicePointManager.ServerCertificateValidationCallback = (sender, certificate, chain, sslPolicyErrors) => true;
ServicePointManager.CheckCertificateRevocationList = false;

Is there anything else I can try to get this great library to function ?

Thanks

daneel3001 avatar Sep 11 '25 07:09 daneel3001