"mr create" does not work with GitLab host that uses relative/sub-path
### Checklist - [x] I'm using the latest version of the extension (Run `glab --version`) - Extension version: tested `glab 1.62.0 (1df2df0d)` & `glab 1.61.0 (ef3ade5e)` - [x] Operating system and version: See [OS env below](#environment) - [x] ~~Gitlab.com or~~ self-managed instance - [x] GitLab version (if self-managed) v17.8.0 ([customer](https://gitlab.zendesk.com/agent/tickets/638821)) & v16.11.10 (me) - [x] I have performed `glab auth status --hostname …host…/gitlab` to check for authentication issues ``` $ glab auth status --hostname …host…/gitlab …host…/gitlab ✓ Logged in to …host…/gitlab as root (/Users/katrinleinweber/.config/glab-cli/config.yml) ✓ Git operations for …host…/gitlab configured to use https protocol. ✓ API calls for …host…/gitlab are made over https protocol. ✓ REST API Endpoint: https://…host…/gitlab/api/v4/ ✓ GraphQL Endpoint: https://…host…/gitlab/api/graphql/ ✓ Token: ************************** ``` - [x] Run the command in debug mode (like `DEBUG=true glab mr list`) and attach any useful output ``` $ DEBUG=true glab mr create [git remote -v] [git config --get-regexp ^remote\..*\.glab-resolved$] 2025/07/11 13:59:52 Could not parse telemetry config value - defaulting to 'true' [git remote -v] [git config --get-regexp ^remote\..*\.glab-resolved$] [git remote -v] [git config --get-regexp ^remote\..*\.glab-resolved$] Could not create recovery file: 1 error occurred: * gitlab/…group…/…project…: 404 Not Found ERROR: 1 error occurred: * gitlab/…group…/…project…: 404 Not Found ``` ### Summary Although [we fixed a related issue](https://gitlab.com/gitlab-org/cli/-/issues/1168), there there still seems to be a bug related to recognizing the relative/sub-path in the local `git remote` configuration. ### Environment - OS: Darwin 24.5.0 arm64 - SHELL: /bin/zsh - TERM: xterm-256color - GLAB: glab 1.62.0 (1df2df0d) ### Steps to reproduce 1. Configure a GitLab test instance with `external_url '…host…/xyz'` 2. `glab auth login --hostname …host…/xyz` :ballot_box_with_check: 3. Clone a test repo via HTTPS, create new branch & commit 4. `glab mr create` ### What is the current _bug_ behavior? ``` Could not create recovery file: none of the git remotes configured for this repository point to a known GitLab host. Please use `glab auth login` to authenticate and configure a new host for glab. Configured remotes: …host…ERROR: none of the git remotes configured for this repository point to a known GitLab host. Please use `glab auth login` to authenticate and configure a new host for glab. Configured remotes: …host… ### WITHOUT the expected `/gitlab !!! ``` ### What is the expected _correct_ behavior? The same as when ``external_url '…host…'` without relative/sub-path were used: ``` $ glab mr create ? Choose a template: Open a merge request with commit messages. ? Title: Test ? Description <Received> ? What's next? Submit Creating merge request for test into main in … !2 Test (test) https://…host…/…/-/merge_requests/… ``` ### ~~Relevant logs and/or screenshots~~ ### Possible fixes I noticed that `git config --get-regexp ^remote\..*\.glab-resolved` from the `DEBUG=true` output fails, but `git config --get-regexp '^remote\..*\.glab-resolved'` works. ~~So, would it be as simple as inserting the `'`: [remoteCmd := exec.Command("git", "config", "--get-regexp", `'^remote\..*\.glab-resolved$'`)](https://gitlab.com/gitlab-org/cli/blob/v1.62.0/internal/git/git.go#L354)~~ Nope: Same error as above, after successful compilation of that change. ``` [git config --get-regexp '^remote\..*\.glab-resolved$'] Could not create recovery file: 1 error occurred: * gitlab/…group…/…project…: 404 Not Found ```
issue