Configure git to use the certificate, if needed

This commit is contained in:
Michael B. Gale
2025-09-04 18:05:38 +01:00
parent bc38b79c9a
commit 8c8499229d

View File

@@ -129,6 +129,18 @@ func getEnvVars() []string {
if len(git_sources) > 0 {
goprivate = append(goprivate, git_sources...)
if proxy_cert_file != "" {
slog.Info("Configuring `git` to use proxy certificate", slog.String("path", proxy_cert_file))
cmd := exec.Command("git", "config", "--global", "http.sslCAInfo", proxy_cert_file)
out, cmdErr := cmd.CombinedOutput()
slog.Info(string(out))
if cmdErr != nil {
slog.Error("Failed to configure `git` to accept the certificate file", slog.String("error", cmdErr.Error()))
}
}
}
result = append(result, fmt.Sprintf("GOPRIVATE=%s", strings.Join(goprivate, ",")))