WARNING: If you're reading this in 2021 or later, you're likely better served by reading:
- https://go.dev/cmd/go#hdr-Configuration_for_downloading_non_public_code
- https://go.dev/ref/mod#private-modules
(This gist was created in 2013 and targeted the legacy GOPATH mode.)
$ ssh -A vm
$ git config --global url."git@github.com:".insteadOf "https://github.com/"
$ cat ~/.gitconfig
[url "git@github.com:"]
insteadOf = https://github.com/
$ go get github.com/private/repo && echo Success!
Success!
Sources:
The @bobziuchkovski's comment wasn't help me.
But i'm tried to execute next commands:
git config --global url."https://<username>:<access_token>@private-git.com/".insteadOf "https://private-git.com/"
go get private-git.com/owner/repo