Skip to content

Commit

Permalink
fix git http_proxy ignored
Browse files Browse the repository at this point in the history
Signed-off-by: Steeve Chailloux <[email protected]>
  • Loading branch information
WnP committed Jan 15, 2025
1 parent ee725f1 commit 0f16557
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions util/gitutil/git_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@ func (cli *GitCLI) Run(ctx context.Context, args ...string) (_ []byte, err error
if cli.git != "" {
gitBinary = cli.git
}
proxyEnvVars := [...]string{
"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY",
"http_proxy", "https_proxy", "no_proxy",
}

for {
var cmd *exec.Cmd
Expand Down Expand Up @@ -190,6 +194,11 @@ func (cli *GitCLI) Run(ctx context.Context, args ...string) (_ []byte, err error
"HOME=/dev/null", // Disable reading from user gitconfig.
"LC_ALL=C", // Ensure consistent output.
}
for _, ev := range proxyEnvVars {
if v, ok := os.LookupEnv(ev); ok {
cmd.Env = append(cmd.Env, ev+"="+v)
}
}
if cli.sshAuthSock != "" {
cmd.Env = append(cmd.Env, "SSH_AUTH_SOCK="+cli.sshAuthSock)
}
Expand Down

0 comments on commit 0f16557

Please sign in to comment.