diff --git a/components/gitpod-cli/cmd/credential-helper.go b/components/gitpod-cli/cmd/credential-helper.go index c1acc304ddacd1..08f823c84fa467 100644 --- a/components/gitpod-cli/cmd/credential-helper.go +++ b/components/gitpod-cli/cmd/credential-helper.go @@ -148,7 +148,7 @@ func parseHostFromStdin() string { func parseProcessTree() (repoUrl string, gitCommand string) { gitCommandRegExp := regexp.MustCompile(`git(,\d+\s+|\s+)(push|clone|fetch|pull|diff)`) - repoUrlRegExp := regexp.MustCompile(`\sorigin\s*(https:.*\.git)\s`) + repoUrlRegExp := regexp.MustCompile(`\sorigin\s*(https:[^\s]*)\s`) pid := os.Getpid() for { cmdLine := readProc(pid, "cmdline") @@ -166,6 +166,9 @@ func parseProcessTree() (repoUrl string, gitCommand string) { match := repoUrlRegExp.FindStringSubmatch(cmdLineString) if len(match) == 2 { repoUrl = match[1] + if !strings.HasSuffix(repoUrl, ".git") { + repoUrl = repoUrl + ".git" + } } } if repoUrl != "" && gitCommand != "" {