How to use GLab – A GitLab Command Line Tool ?

GLab is an open source Gitlab Cli tool written in Go (golang) to help work seamlessly with Gitlab from the command line.

To use glab, you will need to do two things first,

Install glab

$ curl -s https://raw.githubusercontent.com/profclems/glab/trunk/scripts/install.sh | sudo sh
Fetching latest version
Found version 1.22.0
Downloading glab_1.22.0_Linux_x86_64.tar.gz
Installing...
Cleaning up temp files
Successfully installed glab into /usr/bin/

This will install glab in your Linux terminal.

Create personal access token in GitLab

You need to follow steps from “How to Create a personal access token in GitLab ?” and note down the personal access token.

Once you have personal access token, you can login from command line as,

$ glab auth login
$ glab auth login
? What GitLab instance do you want to log into?  [Use arrows to move, type to filter]
> gitlab.com
  GitLab Self-hosted Instance

Click on Enter above.

On next step, you need to enter the access token and press enter, upon which you will be able to successfully login using terminal.

Now, create a repository under your account using the current directory name

$ glab repo create

create a repository under a group using the current directory name

$ glab repo create --group my-group

create a repository with a specific name

$ glab repo create my-project

create a repository for a group

$ glab repo create my-group/my-project

Reference – https://glab.readthedocs.io/en/latest/intro.html#

Leave a Comment