Improve error message when no remotes match configured hosts

Problem to solve

As seen in #1320 (closed) it can be difficult to understand why a glab command didn't work when no remotes match configured hosts. This is especially true when using ~/.ssh/config

Proposal

When a user gets the none of the git remotes configured for this repository points to a known GitLab host. Please use glab auth login to authenticate and configure a new host for glab error, we should print out a list of unique resolved remotes.

When a user gets the none of the git remotes configured for this repository correspond to the GITLAB_HOST environment variable. Try adding a matching remote or unsetting the variable we should print out the value of GITLAB_HOST

Additional tests also need to be added to remote_resolver_test.go

Links / references

https://gitlab.com/gitlab-org/cli/-/blob/main/commands/cmdutils/remote_resolver.go?ref_type=heads#L72-92

Assignee Loading
Time tracking Loading