Skip to content

Commit 6e8e2a5

Browse files
jeanp413roboquat
authored andcommitted
Fix credential helper regression
1 parent 462e269 commit 6e8e2a5

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

components/gitpod-cli/cmd/credential-helper.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,16 @@ var credentialHelper = &cobra.Command{
4646
defer func() {
4747
// Credentials not found, return `quit=true` so no further helpers will be consulted, nor will the user be prompted.
4848
// From https://git-scm.com/docs/gitcredentials#_custom_helpers
49-
if user == "" || token == "" {
49+
if token == "" {
5050
fmt.Print("quit=true\n")
51-
} else {
52-
fmt.Printf("username=%s\npassword=%s\n", user, token)
51+
return
5352
}
53+
// Server could return only the token and not the username, so we fallback to hardcoded `oauth2` username.
54+
// See https://github.com/gitpod-io/gitpod/pull/7889#discussion_r801670957
55+
if user == "" {
56+
user = "oauth2"
57+
}
58+
fmt.Printf("username=%s\npassword=%s\n", user, token)
5459
}()
5560

5661
host, err := parseHostFromStdin()

0 commit comments

Comments
 (0)