Skip to content

Gitlabcli is a command line tool to interact with Gitlab

License

Notifications You must be signed in to change notification settings

apenella/gitlabcli

Repository files navigation

Gitlabcli

Gitlabcli is a command line tool to interactuate with Gitlab repository

Disclaimer: gitlabcli has only been tested on Linux systems

Getting started

Installation

Installation from tarball

  • Download gitlabcli tarball from github releases
$ curl -sLO https://github.com/apenella/gitlabcli/releases/download/v0.3.1/gitlabcli_0.3.1_Linux-x86_64.tar.gz
  • Untar gitlabcli package
$ tar xzfv gitlabcli_0.3.1_Linux-x86_64.tar.gz
  • Start using gitlabcli
$ gitlabcli -help
Set of utils to manage Gitlab repositories

Usage:
  gitlabcli [flags]
  gitlabcli [command]

Available Commands:
  clone       Clone repositories from Gitlab to localhost
  completion  generate the autocompletion script for the specified shell
  get         Get information from Gitlab
  help        Help about any command
  initialize  Initializes gitlabcli
  list        List Gitlab contents
  version     gitlabcli version

Flags:
      --config string   Configuration file
  -h, --help            help for gitlabcli

Use "gitlabcli [command] --help" for more information about a command.

Configuration

Before start using gitlabcli you must create its configuration file. By default, configuration file location is ~/.config/gitlabcli/config.yml but you could store it to any location. In that case, --config flag must be provided on the command call.

You could run the initialize subcommand to initialize gitlabcli. That command takes care to initialize the configuration parameters properly.

$ gitlabcli initialize --gitlab-api-url https://mygitlab.com/api/v4 --working-dir /projects

Environment variables

gitlabcli supports environment variables configuration. In that case, environment variables must be named as uppercased parameter name and prefixed by GITLABCLI_. For instance, working_dir parameter could be configured by GITLABCLI_WORKING_DIR environment variable.

Configuration parameteres

Parameter Type Description
gitlab_api_url string Gitlab API URL base. Check it on Gitlab documentation
gitlab_token string Token to authenticate to Gitlab API
working_dir string Location to store cloned projects

Example:

gitlab_api_url: https://mygitlab.com/api/v4
gitlab_token: ThatIsAGitlabToken
working_dir: /projects

Commands

  • Clone: Clone one or multiple projects from Gitlab. It also supports to clone all Gitlab projects or those projects that belong to a group.
  • List
    • Achieve a Gitlab projects list
    • Achieve a Gitlab groups list
  • Get
    • Get project details
    • Get group details
  • Initialize: Initialize gitlabcli configuration

Authentication

list and get operations uses Gitlab API and requires a Gitlab token.

Clone operations only support to clone over ssh and the only supported authentication method is ssh-agent

Comming updates, new features or ideas

  • Private key file authentication when cloning projects
  • User/pass authentication when cloning projects over HTTP/S

License

gitlabcli is available under MIT license.