Gitlab API Command Line Access

There appears to be a few methods for managing a Gitlab installation from the command line. I liked python-gitlab and I installed it onto Linux Mint/Ubuntu as follows:

apt-get install python-pip
pip install python-gitlab

After installation I created a config file:


With the content as below but the private_token would need changed for your own server:

default = gitlab_server1
ssl_verify = true
timeout = 5

url =
private_token = b123456789123456789S

url =
private_token = x123456789123456789C
timeout = 1

The python-gitlab file is installed as /usr/local/bin/gitlab and can be used as follows:

/usr/local/bin/gitlab -c ~/.python-gitlab.cfg -g gitlab_server1 user list

Or for short

gitlab user list

List Projects

gitlab -g hpdc project list

This equates to the API call below:

curl --header "PRIVATE-TOKEN: x123456789123456789C" "https:/"







Leave a Reply

  • (will not be published)

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>