diff --git a/main.go b/main.go index 4405343..044b42e 100644 --- a/main.go +++ b/main.go @@ -308,9 +308,15 @@ func main() { default: storage = "cache --timeout 7200" } + oauth_path := "oauth" + _, called_by_git := os.LookupEnv("GIT_EXEC_PATH") + exec_path, err := os.Executable() + if !called_by_git && err == nil && !strings.HasPrefix(exec_path, "/tmp") { + oauth_path = exec_path + } commands = []*exec.Cmd{exec.Command(gitPath, "config", "--global", "--unset-all", "credential.helper"), exec.Command(gitPath, "config", "--global", "--add", "credential.helper", storage), - exec.Command(gitPath, "config", "--global", "--add", "credential.helper", "oauth")} + exec.Command(gitPath, "config", "--global", "--add", "credential.helper", oauth_path)} } else if args[0] == "unconfigure" { commands = []*exec.Cmd{exec.Command(gitPath, "config", "--global", "--unset-all", "credential.helper", "oauth")} }