LinuxCommandLibrary

glab-auth

Authenticate glab CLI with GitLab instance

TLDR

Log in with interactive prompt

$ glab auth login
copy

Log in with a token
$ glab auth login [[-t|--token]] [token]
copy

Check authentication status
$ glab auth status
copy

Log in to a specific GitLab instance
$ glab auth login [[-h|--hostname]] [gitlab.example.com]
copy

SYNOPSIS

glab auth [flags]

PARAMETERS

login
    Authenticates with GitLab using OAuth. Opens a browser window for login. Supports different authentication flows and instance selection.

status
    Checks the current authentication status and lists the configured GitLab instances.

logout
    Removes the authentication token for a specific GitLab instance, effectively logging you out.

whoami
    Displays the currently authenticated user and their GitLab instance.

token
    Sets or displays the authentication token

DESCRIPTION

The `glab auth` command family allows users to authenticate with their GitLab instance. This is necessary for glab to interact with GitLab on your behalf, enabling actions like creating merge requests, managing issues, and more. The basic flow typically involves logging in through a web browser, granting glab the necessary permissions, and storing the authentication token securely. Different subcommands handle different aspects of authentication, such as login, status checking, and token management. By default, `glab auth` uses OAuth authentication. If you have already authenticated with the GitLab Workflow VS Code extension, glab will attempt to reuse that authentication. Successful authentication stores the token in the system's credential store or a configuration file, which glab uses for future interactions with your GitLab instance. Authentication can be instance-specific, allowing you to work with multiple GitLab instances simultaneously. Understanding the authentication mechanism is crucial for secure and efficient use of `glab`.

AUTHENTICATION METHODS

glab primarily uses OAuth for authentication. This method is considered more secure as it avoids storing your GitLab password directly. Alternatively, it can use token-based authentication using personal access tokens. Make sure you have the correct scopes set on your personal access token.

CONFIGURATION

Glab stores the configuration data in $HOME/.config/glab-cli/config.yml. Sensitive data such as authentication tokens, are stored using the system's credential store when possible

SEE ALSO

git(1), ssh(1)

Copied to clipboard