go get private repo

Go Modules

Go modules is becomming the standard go dependency tooling. It reuses teh go get command that’s been around for a long time.

go get doesn’t automatically handle private repos well.

If you usually clone repos using ssh, then you need to run the following git config command:

1
git config --global url.'[email protected]:'.insteadOf 'https://github.com/'

It updates $HOME/.gitconfig with:

1
2
[url "[email protected]:"]
	insteadOf = https://github.com/

Then you can:

1
go mod download