Skip to content

Commit

Permalink
git migration: don't prompt interactively for clone credentials (go-g…
Browse files Browse the repository at this point in the history
…itea#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>
  • Loading branch information
2 people authored and AbdulrhmnGhanem committed Aug 10, 2021
1 parent e640ea4 commit 110f4a3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/git/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,18 @@ func (c *Command) RunInDirTimeoutEnvFullPipelineFunc(env []string, timeout time.

cmd := exec.CommandContext(ctx, c.name, c.args...)
if env == nil {
cmd.Env = append(os.Environ(), fmt.Sprintf("LC_ALL=%s", DefaultLocale))
cmd.Env = os.Environ()
} else {
cmd.Env = env
cmd.Env = append(cmd.Env, fmt.Sprintf("LC_ALL=%s", DefaultLocale))
}

cmd.Env = append(
cmd.Env,
fmt.Sprintf("LC_ALL=%s", DefaultLocale),
// avoid prompting for credentials interactively, supported since git v2.3
"GIT_TERMINAL_PROMPT=0",
)

// TODO: verify if this is still needed in golang 1.15
if goVersionLessThan115 {
cmd.Env = append(cmd.Env, "GODEBUG=asyncpreemptoff=1")
Expand Down

0 comments on commit 110f4a3

Please sign in to comment.