From ef9bc21b8fe26842363cedafe1ba57f00c11c3ad Mon Sep 17 00:00:00 2001 From: Bryce Cronkite-Ratcliff Date: Thu, 31 May 2018 13:46:51 -0700 Subject: [PATCH] Error if HTTP & SSH parameters provided If both HTTP and SSH parameters are provided to the container on startup, return an error to help users that have confused their configurations. --- cmd/git-sync/main.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmd/git-sync/main.go b/cmd/git-sync/main.go index 7af34b5..8dafe40 100644 --- a/cmd/git-sync/main.go +++ b/cmd/git-sync/main.go @@ -149,6 +149,11 @@ func main() { os.Exit(1) } + if (*flUsername != "" || *flPassword != "" || *flCookieFile) && *flSSH { + fmt.Fprintf(os.Stderr, "ERROR: GIT_SYNC_SSH set but HTTP parameters provided. These cannot be used together.") + os.Exit(1) + } + if *flUsername != "" && *flPassword != "" { if err := setupGitAuth(*flUsername, *flPassword, *flRepo); err != nil { fmt.Fprintf(os.Stderr, "ERROR: can't create .netrc file: %v\n", err)