A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.gitlab.com/editor_extensions/gitlab_cli/ below:

GitLab CLI - `glab` | GitLab Docs

glab is an open source GitLab CLI tool. It brings GitLab to your terminal: next to where you are already working with Git and your code, without switching between windows and browser tabs.

The GitLab CLI uses commands structured like glab <command> <subcommand> [flags] to perform many of the actions you usually do from the GitLab user interface:

# Sign in
glab auth login --stdin < token.txt

# View a list of issues
glab issue list

# Create merge request for issue 123
glab mr create 123

# Check out the branch for merge request 243
glab mr checkout 243

# Watch the pipeline in progress
glab pipeline ci view

# View, approve, and merge the merge request
glab mr view
glab mr approve
glab mr merge
Core commands GitLab Duo for the CLI

History

The GitLab CLI includes features powered by GitLab Duo. These include:

To ask questions about git commands while you work, type:

The glab duo ask command can help you remember a git command you forgot, or provide suggestions on how to run git commands to perform other tasks.

Install the CLI

Installation instructions are available in the glab README.

Authenticate with GitLab

To authenticate with your GitLab account, run glab auth login. glab respects tokens set using GITLAB_TOKEN.

glab also integrates with the 1Password shell plugin for secure authentication.

Examples Run a CI/CD pipeline with variables from a file

The glab ci run command, when run with the -f (--variables-from-string) flag, uses values stored in an external file. For example, add this code to your .gitlab-ci.yml file to reference two variables:

stages:
  - build

# $EXAMPLE_VARIABLE_1 and $EXAMPLE_VARIABLE_2 are stored in another file
build-job:
  stage: build
  script:
    - echo $EXAMPLE_VARIABLE_1
    - echo $EXAMPLE_VARIABLE_2
    - echo $CI_JOB_ID

Then, create a file named variables.json to contain those variables:

[
  {
    "key": "EXAMPLE_VARIABLE_1",
    "value": "example value 1"
  },
  {
    "key": "EXAMPLE_VARIABLE_2",
    "value": "example value 2"
  }
]

To start a CI/CD pipeline that includes the contents of variables.json, run this command, editing the path to the file as needed:

$ glab ci run --variables-file /tmp/variables.json`

$ echo $EXAMPLE_VARIABLE_1
example value 1
$ echo $EXAMPLE_VARIABLE_2
example value 2
$ echo $CI_JOB_ID
9811701914
Use the CLI as a Docker credential helper

You can use the CLI as a Docker credential helper when pulling images from the GitLab container registry or the container image dependency proxy. To configure the credential helper do the following:

  1. Run glab auth login.
  2. Select the type of GitLab instance to sign in to. If prompted, enter your GitLab hostname.
  3. For sign-in method, select Web.
  4. Enter a comma-separated list of domains used for the container registry and container image proxy. When signing in to GitLab.com, default values are provided.
  5. After authenticating, run glab auth configure-docker to initialize the credential helper in your Docker configuration.
Report issues

Open an issue in the gitlab-org/cli repository to send us feedback.

Troubleshooting glab completion commands fail when using the 1Password shell plugin

The 1Password shell plugin adds the alias glab='op plugin run -- glab', which can interfere with the glab completion command. If your glab completion commands fail, configure your shell to prevent expanding aliases before performing completions:

For more information, see issue 122 for the 1Password shell plugin.

Commands use the wrong Git remote

If a Git repository has multiple remotes and you select the wrong one, commands might return empty results if they query the wrong remote. To fix this problem, change the remote glab uses for a repository:

  1. From your terminal, run git config edit.

  2. Find the lines that include glab-resolved = base, and if incorrect, remove them.

  3. Save your changes to your Git configuration file.

  4. To set the default you’d like to use, run this command. Edit the example and replace origin with the name of your preferred remote:

    git config --append remote.origin.glab-resolved base

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4