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

GitHub enterprise with internal certificate #1439

Closed
BrendanThompson opened this issue Feb 23, 2020 · 2 comments
Closed

GitHub enterprise with internal certificate #1439

BrendanThompson opened this issue Feb 23, 2020 · 2 comments

Comments

@BrendanThompson
Copy link

Currently trying to execute this on GHE where the certificate is signed by an internal CA as such not trusted by Golang or the TLS client. Is there a way to instruct the go-github library to ignore certificate errors?

@gmlewis
Copy link
Collaborator

gmlewis commented Feb 23, 2020

I'm on my cell phone at the moment, but I'm pretty sure you can override the baseURL and use http://.

@BrendanThompson
Copy link
Author

@gmlewis thanks for that. Looks like I found a way to solve this :)

	ctx := context.Background()
	httpTransport := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	httpClient := &http.Client{Transport: httpTransport}
	ts := oauth2.StaticTokenSource(
		&oauth2.Token{AccessToken: "... TOKEN ..."},
	)

	ctx = context.WithValue(ctx, oauth2.HTTPClient, httpClient)

	tc := oauth2.NewClient(ctx, ts)

	client, err := github.NewEnterpriseClient("https://github.enterprise/api/v3", "https://github.enterprise/", tc)
	if err != nil {
		panic(err)
	}

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

2 participants