Skip to content

Commit a137ee7

Browse files
noerwlunny
andauthored
git migration: don't prompt interactively for clone credentials (#15902)
* don't prompt interactively for clone credentials * apply GIT_TERMINAL_PROMPT=0 to all git cmds Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 131b59e commit a137ee7

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

modules/git/command.go

+8-2
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,18 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time.
124124

125125
cmd := exec.CommandContext(ctx, c.name, c.args...)
126126
if env == nil {
127-
cmd.Env = append(os.Environ(), fmt.Sprintf("LC_ALL=%s", DefaultLocale))
127+
cmd.Env = os.Environ()
128128
} else {
129129
cmd.Env = env
130-
cmd.Env = append(cmd.Env, fmt.Sprintf("LC_ALL=%s", DefaultLocale))
131130
}
132131

132+
cmd.Env = append(
133+
cmd.Env,
134+
fmt.Sprintf("LC_ALL=%s", DefaultLocale),
135+
// avoid prompting for credentials interactively, supported since git v2.3
136+
"GIT_TERMINAL_PROMPT=0",
137+
)
138+
133139
// TODO: verify if this is still needed in golang 1.15
134140
if goVersionLessThan115 {
135141
cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1")

0 commit comments

Comments
 (0)