Skip to content

Commit f4b10e0

Browse files
committed
Merge pull request git-lfs#257 from github/better-terminal-prompt-message
better error message if you call git-lfs with GIT_TERMINAL_PROMPT
2 parents 383fced + ac5e6b2 commit f4b10e0

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lfs/credentials.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"bytes"
55
"fmt"
66
"net/url"
7+
"os"
78
"os/exec"
89
"strings"
910
)
@@ -90,6 +91,13 @@ func init() {
9091
err = cmd.Wait()
9192
}
9293

94+
if exitErr, ok := err.(*exec.ExitError); ok {
95+
if exitErr.ProcessState.Success() == false && os.Getenv("GIT_TERMINAL_PROMPT") == "0" {
96+
return nil, fmt.Errorf("Change the GIT_TERMINAL_PROMPT env var to be prompted to enter your credentials for %s://%s.",
97+
input["protocol"], input["host"])
98+
}
99+
}
100+
93101
if err != nil {
94102
return cmd, fmt.Errorf("'git credential %s' error: %s\n", cmd.SubCommand, err.Error())
95103
}

0 commit comments

Comments
 (0)