Work seamlessly with GitLab from the command line. Manage merge requests, issues, pipelines, releases, and more — without leaving your terminal.
A powerful CLI that brings the full GitLab workflow to your terminal with a familiar, intuitive interface.
Create, review, approve, and merge MRs without leaving your terminal. Supports draft MRs, assignees, reviewers, and labels.
glab mr create --title "Feature" --draftFull issue lifecycle management. Create, assign, label, comment, and close issues from the command line.
glab issue list --state openedTrigger pipelines, view job logs, retry failed builds, and monitor CI status right from your terminal.
glab pipeline run --branch mainClone, create, fork, and manage repositories. Full support for groups and namespaces.
glab repo clone owner/repoFollows the same command patterns as GitHub CLI (gh). If you know gh, you already know glab.
glab <noun> <verb> [flags]Login via browser OAuth or personal access tokens. Tokens auto-refresh when expired. Works with gitlab.com and any self-hosted instance.
glab auth loginManage package registries (npm, Maven, PyPI, etc.) and container image repositories directly from the CLI.
glab package list --type npmAnalyze pipeline success rates, duration trends, slowest jobs, and flaky test detection to optimize your CI/CD.
glab pipeline stats --days 30Built-in Model Context Protocol server with 39 tools, 4 resources, and 5 prompt templates for AI integration.
glab mcp installMultiple installation methods to fit your workflow. Pick whichever suits you best.
brew tap PhilipKram/tap https://github.com/PhilipKram/Gitlab-CLI brew install PhilipKram/tap/glab
# Requires Go 1.22+ go install github.com/PhilipKram/gitlab-cli@latest
Download pre-built binaries for Linux, macOS, and Windows from the releases page.
Available for amd64 and arm64.
git clone https://github.com/PhilipKram/Gitlab-CLI.git cd Gitlab-CLI make build # Binary at ./bin/glab
Authenticate with your GitLab instance. OAuth is the default — just run glab auth login and it opens your browser.
The CLI starts a local server on port 7171, opens your browser for authorization, and exchanges the code for a token using PKCE — no client secret needed.
# OAuth login (default) — opens your browser glab auth login # Login to a specific host glab auth login --hostname gitlab.example.com # Login with a personal access token instead glab auth login --token glpat-xxxxxxxxxxxxxxxxxxxx # Or set an environment variable export GITLAB_TOKEN="glpat-xxxxxxxxxxxxxxxxxxxx"
Before your first OAuth login, create an OAuth application in your GitLab instance under Settings > Applications:
http://localhost:7171/auth/redirectapi read_user write_repository openid profile
OAuth tokens expire after ~2 hours. glab automatically detects expiry and refreshes in the background using the stored refresh token.
Run glab auth status to see when your token expires. Tokens provided via environment variables are never auto-refreshed.
Comprehensive coverage of GitLab features organized into intuitive command groups.
Global Flag:
--repo, -R
Select a GitLab repository using HOST/OWNER/REPO format.
When omitted, glab resolves the host from the git remote, falls back to the default host, then to the first authenticated host.
Common patterns for day-to-day GitLab usage, straight from the terminal.
Create, review, comment on, and merge a merge request — all without leaving the terminal.
# Create a merge request from current branch glab mr create --title "Add user authentication" \ --description "Implements OAuth2 login flow" \ --assignee @alice --reviewer @bob \ --label feature,auth --draft # List open MRs assigned to you glab mr list --state opened # Check out a teammate's MR for review glab mr checkout 42 # Leave an inline comment on the diff glab mr comment 42 --body "Consider refactoring this" \ --file "src/auth.go" --line 57 # Approve and merge glab mr approve 42 glab mr merge 42 --squash --remove-source-branch
Trigger, monitor, and debug CI/CD pipelines without opening the GitLab web UI.
# Trigger a pipeline on main glab pipeline run --branch main --variables DEPLOY_ENV=staging # Watch pipeline status glab pipeline list --ref main --limit 5 # Debug a failed job glab pipeline jobs 12345 glab pipeline job-log 67890
Manage bugs, features, and tasks from the command line — create, assign, label, and close issues.
# Create a bug report glab issue create --title "Login page broken on Safari" \ --label bug,P1 --assignee @alice # Find issues by label glab issue list --label bug --state opened # Close with a comment glab issue comment 42 --body "Fixed in !99" glab issue close 42
Work with remote projects, raw API access, JSON output for scripting, and self-upgrade.
# Target a project on any GitLab instance glab issue list -R gitlab.example.com/group/project glab mr list --state opened -R gitlab.example.com/team/app # Direct API access with specific host glab api '/projects?membership=true' --hostname gitlab.example.com # :id auto-resolves to current project glab api '/projects/:id/pipelines?per_page=5' # Get MR data as JSON glab mr list --json | jq '.[].title' # GraphQL queries glab api graphql --method POST \ --body '{"query":"{ currentUser { name } }"}' # Upgrade to the latest version glab upgrade --yes
Configuration stored in ~/.config/glab/. Override with the GLAB_CONFIG_DIR environment variable.
| Key | Description |
|---|---|
| editor | Preferred text editor |
| pager | Preferred pager program |
| browser | Preferred web browser |
| protocol | Git protocol: https or ssh |
| git_remote | Default git remote name |
| Key | Description |
|---|---|
| client_id | OAuth application ID |
| redirect_uri | OAuth redirect URI |
| oauth_scopes | OAuth scopes |
| protocol | Git protocol for this host |
| api_host | API hostname override |
| Variable | Description |
|---|---|
| GITLAB_TOKEN | Authentication token (overrides stored config) |
| GLAB_TOKEN | Authentication token (alternative) |
| GITLAB_HOST | Default GitLab hostname (default: gitlab.com) |
| GLAB_CONFIG_DIR | Configuration directory path |
# Store OAuth client ID for a self-hosted instance glab config set client_id <app-id> --host gitlab.example.com # Store custom redirect URI glab config set redirect_uri http://localhost:8080/callback --host gitlab.example.com # Store custom OAuth scopes glab config set oauth_scopes "api read_user write_repository" --host gitlab.example.com