LinuxCommandLibrary

gitlab

Interact with GitLab from the command line

TLDR

Create a new project

$ gitlab create_project [project_name]
copy

Get info about a specific commit
$ gitlab commit [project_name] [commit_hash]
copy

Get info about jobs in a CI pipeline
$ gitlab pipeline_jobs [project_name] [pipeline_id]
copy

Start a specific CI job
$ gitlab job_play [project_name] [job_id]
copy

SYNOPSIS

gitlab <command> [options]

PARAMETERS

help
    Displays help information about the command or a subcommand.

version
    Shows the version of the gitlab command-line tool.

config
    Manages the configuration settings for the gitlab command-line tool. This can include setting the GitLab instance URL, private token, and other relevant settings.

project
    Interacts with GitLab projects. Allows you to create, list, or manage projects.

issue
    Manages GitLab issues. You can create, list, close, or assign issues.

mr
    Manages GitLab merge requests (also known as pull requests). Create, list, approve, and merge requests.

pipeline
    Manages GitLab pipelines. Trigger pipelines, view pipeline status, and access pipeline logs.

snippet
    Manages GitLab snippets. Create, list, or manage snippets.

group
    Interacts with GitLab groups. List or manage projects groups.

DESCRIPTION

The `gitlab` command is a command-line interface for interacting with GitLab instances. It provides tools for creating, managing, and querying GitLab resources directly from your terminal, automating tasks and integrating GitLab workflows into scripts.

It allows users to interact with GitLab repositories, issues, merge requests, pipelines, and other GitLab features without needing to use a web browser. This command line interface simplifies tasks like creating new projects, listing issues assigned to you, triggering pipelines, merging requests and much more. It's particularly valuable for developers and DevOps engineers who prefer working within the command-line environment and need to automate GitLab interactions. It is built to provide a consistent and user-friendly experience, abstracting away the complexities of the GitLab API. Configuration is usually done through environmental variables and configuration files, making it easier to switch between instances and maintain different profiles.

CAVEATS

The exact features and available options depend on the version of the `gitlab` command-line tool and the GitLab instance being used. You need a valid GitLab personal access token or OAuth token configured for authentication.

AUTHENTICATION

The `gitlab` command typically uses environment variables such as `GITLAB_URL` and `GITLAB_TOKEN` for authentication. Make sure these are properly set up before using the tool.

CONFIGURATION FILES

Configuration can also be managed through configuration files, usually located in the user's home directory. Check the documentation for the specific format and location of the configuration file.

RATE LIMITING

GitLab API usage is subject to rate limiting. Be mindful of the number of requests you are making to avoid being rate limited. Implement appropriate retry mechanisms in your scripts.

HISTORY

The `gitlab` command has evolved alongside the GitLab platform itself. Its development has focused on providing a command-line alternative to the GitLab web interface for common tasks, driven by the needs of developers and operations teams to automate and integrate with GitLab workflows. It is maintained actively and features continuously added.

SEE ALSO

curl(1), jq(1)

Copied to clipboard