From 09d36a819eb48d6a2c10b36bf654dcf8867d6641 Mon Sep 17 00:00:00 2001
From: Russ Cox
Date: Wed, 18 Apr 2018 10:45:52 -0400
Subject: [PATCH] doc: update "go get" HTTPS answer to mention .netrc
The existing text makes it seem like there's no way
to use GitHub over HTTPS. There is. Explain that.
Also, the existing text suggests explicit checkout into $GOPATH,
which is not going to work in the new module world.
Drop that alternative.
Also, the existing text uses pushInsteadOf instead of insteadOf,
which would have the effect of being able to push to a private
repo but not clone it in the first place. That seems not helpful,
so suggest insteadOf instead.
Fixes #18927.
Change-Id: Ic358b66f88064b53067d174a2a1591ac8bf96c88
Reviewed-on: https://go-review.googlesource.com/107775
Run-TryBot: Russ Cox
Reviewed-by: Ian Lance Taylor
---
doc/go_faq.html | 29 ++++++++++++++++-------------
1 file changed, 16 insertions(+), 13 deletions(-)
diff --git a/doc/go_faq.html b/doc/go_faq.html
index 9f928c9f55..a6d79b0823 100644
--- a/doc/go_faq.html
+++ b/doc/go_faq.html
@@ -1097,24 +1097,27 @@ The go get
command therefore uses HTTPS for safety.
-If you use git
and prefer to push changes through SSH using your existing key
-it's easy to work around this. For GitHub, try one of these solutions:
+Git
can be configured to authenticate over HTTPS or to use SSH in place of HTTPS.
+To authenticate over HTTPS, you can add a line
+to the $HOME/.netrc
file that git consults:
-
-- Manually clone the repository in the expected package directory:
-$ cd src/github.com/username
-$ git clone git@github.com:username/package.git
+machine github.com login USERNAME password APIKEY
-
-- Force
git push
to use the SSH
protocol by appending
-these two lines to ~/.gitconfig
:
+
+For GitHub accounts, the password can be a
+personal access token.
+
+
+
+Git
can also be configured to use SSH in place of HTTPS for URLs matching a given prefix.
+For example, to use SSH for all GitHub access,
+add these lines to your ~/.gitconfig
:
+
-[url "git@github.com:"]
- pushInsteadOf = https://github.com/
+[url "ssh://git@github.com/"]
+ insteadOf = https://github.com/
-
-
How should I manage package versions using "go get"?
--
2.48.1