Skip to content

LibGit2Sharp.LibGit2SharpException: certificate revocation status could not be verified #2168

@daneel3001

Description

@daneel3001

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions