Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit 8065bb2

Browse files
committed
gps: vcs: suppress git password prompts
1 parent 4ecb1d1 commit 8065bb2

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ BUG FIXES:
44

55
* Releases targeting Windows now have a `.exe` suffix (#1291).
66
* Adaptively recover from dirty and corrupted git repositories in cache (#1279).
7+
* Suppress git password prompts in more places (#1357).
78

89
IMPROVEMENTS:
910

gps/vcs_repo.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ func (r *gitRepo) get(ctx context.Context) error {
9292
r.Remote(),
9393
r.LocalPath(),
9494
)
95+
// Ensure no prompting for PWs
96+
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
9597
if out, err := cmd.CombinedOutput(); err != nil {
9698
return newVcsRemoteErrorOr(err, cmd.Args(), string(out),
9799
"unable to get repository")
@@ -110,6 +112,8 @@ func (r *gitRepo) fetch(ctx context.Context) error {
110112
r.RemoteLocation,
111113
)
112114
cmd.SetDir(r.LocalPath())
115+
// Ensure no prompting for PWs
116+
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
113117
if out, err := cmd.CombinedOutput(); err != nil {
114118
return newVcsRemoteErrorOr(err, cmd.Args(), string(out),
115119
"unable to update repository")
@@ -142,6 +146,8 @@ func (r *gitRepo) defendAgainstSubmodules(ctx context.Context) error {
142146
"--recursive",
143147
)
144148
cmd.SetDir(r.LocalPath())
149+
// Ensure no prompting for PWs
150+
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
145151
if out, err := cmd.CombinedOutput(); err != nil {
146152
return newVcsLocalErrorOr(err, cmd.Args(), string(out),
147153
"unexpected error while defensively updating submodules")

0 commit comments

Comments
 (0)