Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore SSL Verification #140

Closed
kgrvamsi opened this issue Jul 22, 2020 · 4 comments
Closed

Ignore SSL Verification #140

kgrvamsi opened this issue Jul 22, 2020 · 4 comments

Comments

@kgrvamsi
Copy link

How can we turn off SSL Verify with CloneOptions?

Here is how we do it with git

You can tell Git and Git LFS to ignore SSL cert verification errors too. You can disable it for individual commands:

$ GIT_SSL_NO_VERIFY=1 git clone ...

You can also configure individual repositories to ignore verification errors.

$ git config http.sslverify false
$ git clone ...

@riyaz-ali
Copy link

go-git doesn't seem to support GIT_SSL_NO_VERIFY or http.sslverify ..

A quick work-around would be to override the default https transport and provide an http.Client that's configured with tls.Config{InsecureSkipVerify: true} .. you can do that with something similar to the following snippet -

package main

import (
    "net/http"
    "crypto/tls"

    "github.com/go-git/go-git/v5/plumbing/transport/client"
    httptransport "github.com/go-git/go-git/v5/plumbing/transport/http"
)

func init(){
    var transport = httptransport.NewClient(&http.Client{
        transport: &http.Transport{
            TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
        }
    })

    client.InstallProtocol("https", transport)
}

But be careful! disabling security checks is dangerous and should be avoided .. you can read about alternate ways on this stack overflow post

@StrongMonkey
Copy link
Contributor

Hey guys, I put a PR #228 to add support for this. Can anyone take a look at it?

@kgrvamsi
Copy link
Author

@StrongMonkey i will give a try this week

@pjbgf
Copy link
Member

pjbgf commented Nov 7, 2023

Closing this as #228 introduced an easy API for it. Additionally, the example above should also work.

@pjbgf pjbgf closed this as completed Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants