`glab mr create` fails to create merge request due to none of the remotes configured corresponding to GITLAB_HOST. All other `glab mr` commands work (`view`, `list`, `update`, `merge`))

Checklist

  • I'm using the latest version of the extension (Run glab --version)
    • Extension version: glab version 1.26.0
  • Operating system and version: Red Hat Enterprise Linux Workstation release 7.9 (Maipo)
  • Gitlab.com or self-managed instance? Self-Managed
  • GitLab version (if self-managed) 15.9.2-ee (Use the version endpoint, like this: gitlab.my-company.com/api/v4/version)
  • I have performed glab auth status to check for authentication issues

Summary

glab mr create -R GROUP/REPO fails and provides this confusing message:

Failed to create merge request. Created recovery file: /home/<user>/.config/glab-cli/recover/LC/ansible/mr.json
Run the command again with the '--recover' option to retry
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

glab mr create -R LC/ansible --fill --web:

Failed to create merge request. Created recovery file: /home/<user>/.config/glab-cli/recover/LC/ansible/mr.json
Run the command again with the '--recover' option to retry
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

I am able to use other glab mr subcommands without issues.

Steps to reproduce

  1. Run any glab mr create command.

What is the current bug behavior?

Errors out with:

Failed to create merge request. Created recovery file: /home/<user>/.config/glab-cli/recover/LC/ansible/mr.json
Run the command again with the '--recover' option to retry
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

What is the expected correct behavior?

  • glab mr create -R GROUP/REPO -> Create an MR and allow me to interact with it
  • glab mr create -R GROUP/REPO --fill --web -> Launch web browser with an MR page

Relevant logs and/or screenshots

Output from glab auth status:

git-lab-host.com/gitlab
  ✓ Logged in to git-lab-host.com/gitlab as delgado (/home/user/.config/glab-cli/config.yml)
  ✓ Git operations for git-lab-host.com/gitlab configured to use ssh protocol.
  ✓ API calls for git-lab-host.com/gitlab are made over https protocol
  ✓ REST API Endpoint: https://git-lab-host.com/gitlab/api/v4/
  ✓ GraphQL Endpoint: https://git-lab-host.com/gitlab/api/graphql/
  ✓ Token: **************************

Output of git remote -v inside my repo:

https   https://git-lab-host.com/gitlab/GROUP/REPO.git (fetch)
https   https://git-lab-host.com/gitlab/GROUP/REPO.git (push)
httpsremote     https://git-lab-host.com/gitlab/GROUP/REPO.git (fetch)
httpsremote     https://git-lab-host.com/gitlab/GROUP/REPO.git (push)
origin  ssh://git@git-lab-host.com:7999/GROUP/REPO.git (fetch)
origin  ssh://git@git-lab-host.com:7999/GROUP/REPO.git (push)

Other glab mr commands work:

#: glab mr list -R GROUP/REPO
Showing 14 open merge requests on GROUP/REPO (Page 1)

!2943   GROUP/REPO!2943 <redacted>
!2942   GROUP/REPO!2942 <redacted>
!2863   GROUP/REPO!2863 <redacted>
!2848   GROUP/REPO!2848 <redacted>
!2838   GROUP/REPO!2838 <redacted>
!2587   GROUP/REPO!2587 <redacted>
#: glab mr view 2942 -R GROUP/REPO

title:  <redacted>
state:  open
author: user100
labels:
assignees:      user100
reviewers:      user101
comments:       7
number: 2942
url:    https://our-gitlab-host.com/gitlab/GROUP/ansible/-/merge_requests/2942
--
Resolves #92

This adds ...

Possible fixes

My skills in go are non-existent. Skimmed through source to no avail.