Skip to content

Commit

Permalink
if git is not installed, no need to locate a credential helper
Browse files Browse the repository at this point in the history
  • Loading branch information
mvanholsteijn committed Nov 9, 2021
1 parent 7ad4759 commit 12ac3bb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion clone.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ import (
)

func getCredentialHelper(url *neturl.URL) string {
cmd := exec.Command("git", "config", "--get-urlmatch", "credential.helper", url.String())
git, err := exec.LookPath("git")
if err != nil {
if err != exec.ErrNotFound {
log.Printf("ERROR: failed to lookup git on path, %s", err)
}
return ""
}

cmd := exec.Command(git, "config", "--get-urlmatch", "credential.helper", url.String())
helper, err := cmd.Output()
if err == nil {
return strings.TrimSpace(string(helper))
Expand Down

0 comments on commit 12ac3bb

Please sign in to comment.