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.
This commit is contained in:
Bryce Cronkite-Ratcliff 2018-05-31 13:46:51 -07:00 committed by Tim Hockin
parent f69e8fb2c0
commit ef9bc21b8f
1 changed files with 5 additions and 0 deletions

View File

@ -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)