Skip to content

Instantly share code, notes, and snippets.

@dmitshur
Last active July 14, 2024 16:13
Show Gist options
  • Save dmitshur/6927554 to your computer and use it in GitHub Desktop.
Save dmitshur/6927554 to your computer and use it in GitHub Desktop.
[Legacy GOPATH mode] How to `go get` private repos using SSH key auth instead of password auth.

WARNING: If you're reading this in 2021 or later, you're likely better served by reading:

(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:

@StevenACoffman
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment