diff options
author | Bryan C. Mills <bcmills@google.com> | 2021-03-09 23:27:48 -0500 |
---|---|---|
committer | Bryan C. Mills <bcmills@google.com> | 2021-05-04 15:03:06 +0000 |
commit | 86e42c2fbfe14c41746fe5cfc5c8bda94bb4bc4e (patch) | |
tree | fcb71b5a5a6a83564b47a6d64fe96eb38d1456a4 /src/cmd/go/internal/modload/init.go | |
parent | 5e4f9b077f27c79a69677b7c15dbfd157b1698a4 (diff) | |
download | go-86e42c2fbfe14c41746fe5cfc5c8bda94bb4bc4e.tar.gz go-86e42c2fbfe14c41746fe5cfc5c8bda94bb4bc4e.zip |
cmd/go: suppress SSH password prompts when fetching modules or repos
We were already setting GIT_SSH_COMMAND (if unset) to explicitly
include 'ControlMaster=no' in order to disable connection pooling.
Now we also set 'BatchMode=yes' to suppress password prompts for
password-protected keys.
While we're here, we also set GCM_INTERACTIVE=never to suppress
similar prompts from the Git Credential Manager for Windows.
Fixes #44904
Change-Id: Iebb050079ff7dd54d5b944c459ae212e9e6f2579
Reviewed-on: https://go-review.googlesource.com/c/go/+/300157
Trust: Bryan C. Mills <bcmills@google.com>
Run-TryBot: Bryan C. Mills <bcmills@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Diffstat (limited to 'src/cmd/go/internal/modload/init.go')
-rw-r--r-- | src/cmd/go/internal/modload/init.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/cmd/go/internal/modload/init.go b/src/cmd/go/internal/modload/init.go index 88d647d9ea..99c0c2b981 100644 --- a/src/cmd/go/internal/modload/init.go +++ b/src/cmd/go/internal/modload/init.go @@ -163,7 +163,11 @@ func Init() { // assume they know what they are doing and don't step on it. // But default to turning off ControlMaster. if os.Getenv("GIT_SSH") == "" && os.Getenv("GIT_SSH_COMMAND") == "" { - os.Setenv("GIT_SSH_COMMAND", "ssh -o ControlMaster=no") + os.Setenv("GIT_SSH_COMMAND", "ssh -o ControlMaster=no -o BatchMode=yes") + } + + if os.Getenv("GCM_INTERACTIVE") == "" { + os.Setenv("GCM_INTERACTIVE", "never") } if modRoot != "" { |