Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support noproxy #218

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion git.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func doMirrorOrUpdate(gitModule GitModule, workDir string, retryCount int) bool
isInModulesCacheDir := strings.HasPrefix(workDir, config.ModulesCacheDir)

explicitlyLoadSSHKey := true
if len(gitModule.privateKey) == 0 || strings.Contains(gitModule.git, "github.com") || gitModule.useSSHAgent {
if len(gitModule.privateKey) == 0 || strings.Contains(gitModule.git, "github.com") || gitModule.useSSHAgent || strings.HasPrefix(gitModule.git, "https://") {
if gitModule.useSSHAgent || len(gitModule.privateKey) == 0 {
explicitlyLoadSSHKey = false
} else if isControlRepo {
Expand Down
15 changes: 12 additions & 3 deletions helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,18 @@ func executeCommand(command string, commandDir string, timeout int, allowFail bo
execCommand.Dir = commandDir
}
if disableHttpProxy {
Debugf("found matching NO_PROXY URL, trying to disable http_proxy for " + command)
execCommand.Env = append(os.Environ(), "http_proxy=")
execCommand.Env = append(os.Environ(), "https_proxy=")
Debugf("found matching NO_PROXY URL, trying to disable http_proxy and https_proxy env variables for " + command)
// execCommand.Env = append(os.Environ(), "http_proxy=")
// execCommand.Env = append(os.Environ(), "https_proxy=")
os.Unsetenv("http_proxy")
os.Unsetenv("https_proxy")
os.Unsetenv("HTTP_PROXY")
os.Unsetenv("HTTPS_PROXY")
execCommand.Env = os.Environ()
Debugf("exec OS env:" + strings.Join(execCommand.Env, ",") + " for command " + command)
} else {
execCommand.Env = os.Environ()
Debugf("exec OS env:" + strings.Join(execCommand.Env, ",") + " for command " + command)
}
out, err := execCommand.CombinedOutput()
duration := time.Since(before).Seconds()
Expand Down