Skip to content
This repository has been archived by the owner on Sep 9, 2020. It is now read-only.

Commit

Permalink
gps: vcs: suppress git password prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
jmank88 committed Oct 22, 2017
1 parent 7b5c43a commit f1f0bac
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/gps/vcs_repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ func (r *gitRepo) get(ctx context.Context) error {
r.Remote(),
r.LocalPath(),
)
// Ensure no prompting for PWs
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
if out, err := cmd.CombinedOutput(); err != nil {
return newVcsRemoteErrorOr(err, cmd.Args(), string(out),
"unable to get repository")
Expand All @@ -113,6 +115,8 @@ func (r *gitRepo) fetch(ctx context.Context) error {
r.RemoteLocation,
)
cmd.SetDir(r.LocalPath())
// Ensure no prompting for PWs
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
if out, err := cmd.CombinedOutput(); err != nil {
return newVcsRemoteErrorOr(err, cmd.Args(), string(out),
"unable to update repository")
Expand Down Expand Up @@ -145,6 +149,8 @@ func (r *gitRepo) defendAgainstSubmodules(ctx context.Context) error {
"--recursive",
)
cmd.SetDir(r.LocalPath())
// Ensure no prompting for PWs
cmd.SetEnv(append([]string{"GIT_ASKPASS=", "GIT_TERMINAL_PROMPT=0"}, os.Environ()...))
if out, err := cmd.CombinedOutput(); err != nil {
return newVcsLocalErrorOr(err, cmd.Args(), string(out),
"unexpected error while defensively updating submodules")
Expand Down

0 comments on commit f1f0bac

Please sign in to comment.