Skip to content

Commit

Permalink
Merge pull request #44332 from corhere/backport-20.10/fix-git-windows…
Browse files Browse the repository at this point in the history
…-environ

[20.10] builder: fix running git commands on Windows
  • Loading branch information
thaJeztah committed Oct 20, 2022
2 parents 2b7f97a + 5b5b5c6 commit 93c2c3b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion builder/remotecontext/git/gitutils.go
Expand Up @@ -21,6 +21,7 @@ type gitRepo struct {
isolateConfig bool
}

// CloneOption changes the behaviour of Clone().
type CloneOption func(*gitRepo)

// WithIsolatedConfig disables reading the user or system gitconfig files when
Expand Down Expand Up @@ -213,7 +214,7 @@ func (repo gitRepo) gitWithinDir(dir string, args ...string) ([]byte, error) {
cmd := exec.Command("git", args...)
cmd.Dir = dir
// Disable unsafe remote protocols.
cmd.Env = append(cmd.Env, "GIT_PROTOCOL_FROM_USER=0")
cmd.Env = append(os.Environ(), "GIT_PROTOCOL_FROM_USER=0")

if repo.isolateConfig {
cmd.Env = append(cmd.Env,
Expand Down

0 comments on commit 93c2c3b

Please sign in to comment.