WARNING: This gist was created in 2013 and targets the legacy GOPATH mode. If you're reading this in 2021 or later, you're likely better served by reading https://tip.golang.org/cmd/go/#hdr-Configuration_for_downloading_non_public_code and https://golang.org/ref/mod#private-modules.
$ ssh -A vm $ git config --global url."email@example.com:".insteadOf "https://github.com/" $ cat ~/.gitconfig [url "firstname.lastname@example.org:"] insteadOf = https://github.com/ $ go get github.com/private/repo && echo Success! Success!
@mkrull, you are right. That's a change introduced with Go 1.4 (which is after I came up with this solution).
@anphung, an alternative workaround would be to use
go get -u -f github.com/private/repo: