-
-
Save daluu/8636544d77e7371d7b9460037a5cd0dd to your computer and use it in GitHub Desktop.
How to `go get` private repos using SSH key auth instead of password auth.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```bash | |
$ ssh -A vm | |
$ git config --global url."[email protected]:".insteadOf "https://github.com/" | |
$ cat ~/.gitconfig | |
[url "[email protected]:"] | |
insteadOf = https://github.com/ | |
$ go get github.com/private/repo && echo Success! | |
Success! | |
``` | |
Sources: | |
- https://help.github.com/articles/which-remote-url-should-i-use #You can also use SSH agent forwarding with your deploy script to avoid managing keys on the server. | |
- http://golang.org/doc/faq #Why does "go get" use HTTPS when cloning a repository? | |
- https://www.kernel.org/pub/software/scm/git/docs/git-config.html #url.\<base\>.insteadOf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment