Ganitzsh
Ganitzsh

Reputation: 351

go get accept selfsigned certificate from distant host

I'd like to be able to go get from my Stash server with a nice URL. My stash server works only over HTTPS. The problem is that my SSL certificate I'm using with stash is self-signed and any go get to my server gets me the following error:

x509: certificate signed by unknown authority

Is there a way to authorize self-signed certificates from go get?

Upvotes: 10

Views: 15406

Answers (2)

William Brawner
William Brawner

Reputation: 1520

go get -insecure has been deprecated.

As of go 1.14, the correct way to do this is by setting the GOINSECURE environment variable to a comma-separated list of domains from which you'd like to ignore the certs.

E.g. Setting in within ~/.zshrc (if zsh shell)

GOINSECURE=example.com

Then you will be able to install the packages like:

go get example.com/some/pkg

Upvotes: 13

OneOfOne
OneOfOne

Reputation: 99351

Use go get -insecure https://xxxxx.

From go get -h:

The -insecure flag permits fetching from repositories and resolving custom domains using insecure schemes such as HTTP. Use with caution.

Upvotes: 5

Related Questions