How to switch between hosts on glab CLI

When using glab ( / cli · GitLab), is there a way to pass a “–host” parameter to specify which host to use based on entries in the config.yml file? My config.yml file looks [partially] like this:

# configuration specific for gitlab instances
        # What protocol to use to access the api endpoint. Supported values: http, https
        api_protocol: https
        # Configure host for api endpoint, defaults to the host itself
        # Your GitLab access token. Get an access token at
        token: <token_value>
        api_protocol: https
        token: <token_value>
# Default GitLab hostname to use
host: hostA

When on the command line, I would expect the command to look something like

glab repo clone --host gitlab -g <group_id> -p --paginate

but I can’t seem to find if a parameter exists like “–host” to allow me to switch between the hosts identified in the config.yml file for running individual commands.

You can use the GITLAB_HOST variable to specify which host to clone from. glab repo clone  -g <group> --paginate
1 Like