Skip to content

Commit

Permalink
vcs: Do not interactively ask for a password (for git).
Browse files Browse the repository at this point in the history
Fixes potential "Username for 'https://github.com': " interactive
prompts for private repos.
Thank you @pornel for the solution from bower/bower#1009. It took me
half an hour to find a working solution for this problem, which is odd
given that ls-remote is supposed to be a low-level plumbing command to
be used primarily by scripts. :/
  • Loading branch information
dmitshur committed Jul 13, 2014
1 parent 2519e3b commit cd4618c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion git.go
Expand Up @@ -96,7 +96,7 @@ func CheckGitRepoLocal(path, branch string) string {
}

func CheckGitRepoRemote(path, branch string) string {
cmd := exec.Command("git", "ls-remote", "--heads", "origin", branch)
cmd := exec.Command("git", "-c", "core.askpass=true", "ls-remote", "--heads", "origin", branch)
cmd.Dir = path

if out, err := cmd.Output(); err == nil && len(out) >= gitRevisionLength {
Expand Down

0 comments on commit cd4618c

Please sign in to comment.