Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: improve error message around gitaskpass failures#9407

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Emyrk merged 1 commit intomainfromstevenmasley/gitaskpass_error
Aug 30, 2023
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletioncli/gitaskpass.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,7 +44,13 @@ func (r *RootCmd) gitAskpass() *clibase.Cmd {
if errors.As(err, &apiError) && apiError.StatusCode() == http.StatusNotFound {
// This prevents the "Run 'coder --help' for usage"
// message from occurring.
cliui.Errorf(inv.Stderr, "%s\n", apiError.Message)
lines := []string{apiError.Message}
if apiError.Detail != "" {
lines = append(lines, apiError.Detail)
}
cliui.Warn(inv.Stderr, "Coder was unable to handle this git request. The default git behavior will be used instead.",
lines...,
)
return cliui.Canceled
}
return xerrors.Errorf("get git token: %w", err)
Expand Down
11 changes: 10 additions & 1 deletioncoderd/workspaceagents.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1996,8 +1996,17 @@ func (api *API) workspaceAgentsGitAuth(rw http.ResponseWriter, r *http.Request)
gitAuthConfig = gitAuth
}
if gitAuthConfig == nil {
detail := "No git providers are configured."
if len(api.GitAuthConfigs) > 0 {
regexURLs := make([]string, 0, len(api.GitAuthConfigs))
for _, gitAuth := range api.GitAuthConfigs {
regexURLs = append(regexURLs, fmt.Sprintf("%s=%q", gitAuth.ID, gitAuth.Regex.String()))
}
detail = fmt.Sprintf("The configured git provider have regex filters that do not match the git url. Provider url regexs: %s", strings.Join(regexURLs, ","))
}
httpapi.Write(ctx, rw, http.StatusNotFound, codersdk.Response{
Message: fmt.Sprintf("No git provider found for URL %q", gitURL),
Message: fmt.Sprintf("No matching git provider found in Coder for the url %q.", gitURL),
Detail: detail,
})
return
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp