From 844956884498d5447745dc0f542400c1e46d46ff Mon Sep 17 00:00:00 2001 From: Dmitri Shuralyov Date: Sat, 12 Jul 2014 18:15:33 -0700 Subject: [PATCH] vcs: Do not interactively ask for a password (for git). 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. :/ --- vcs/git.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcs/git.go b/vcs/git.go index 341ee16..33cdc9f 100644 --- a/vcs/git.go +++ b/vcs/git.go @@ -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 {