Using the ‘glab’ CLI tool with GNOME GitLab

I like to use the glab command-line tool, which used to be a third-party project but which has apparently now been adopted by GitLab themselves. In particular, the glab mr family of commands to interact with merge requests are invaluable for checking out branches from contributors’ forks.

Since October 2022, GNOME’s GitLab instance now has a somewhat unusual configuration where the SSH hostname ( is different to the web/API hostname ( To make old checkouts continue to work, I have the following configuration in my ~/.ssh/config:


But whether you set the SSH hostname in this way, or use the new hostname in Git remote URLs, glab will complain:

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

To get this to work, set the GitLab hostname to and the API hostname to In ~/.config/glab-cli/config.yml, this looks like this:

        token: redacted
        git_protocol: ssh
        api_protocol: https

With this configuration, glab auth status shows incorrect API URLs, but the tool actually works:

$ glab auth status
  ✓ Logged in to as wjt (/home/wjt/.config/glab-cli/config.yml)
  ✓ Git operations for configured to use ssh protocol.
  ✓ API calls for are made over https protocol
  ✓ REST API Endpoint:
  ✓ GraphQL Endpoint:

I’m posting this because I spent a while trying to find a way to override the SSH hostname, before finding this issue which explains that you do it the other way around, by overriding the API hostname.