You've got Golang modules within a private repository or an organization and would like to go get
them.
For this example the GitHub organization will be spacely-sprockets
.
Set GOPRIVATE
(ideally placed in your .bashrc
/ dotfiles):
export GOPRIVATE="github.com/spacely-sprockets"
Update .gitconfig
:
$ git config --global \
url."ssh://git@github.com/spacely-sprockets".insteadOf \
"https://github.com/spacely-sprockets"
Will add a block like the following:
[url "ssh://git@github.com/spacely-sprockets"]
insteadOf = https://github.com/spacely-sprockets
And finally, lets test:
$ GO111MODULE="on" go get github.com/spacely-sprockets/widgets-golang
go: downloading github.com/spacely-sprockets/widgets-golang...