Skip to content

Cross platform Gitlab management cli written in Go. Download the executable with no dependencies!

License

Notifications You must be signed in to change notification settings

devopsctl/gitlabctl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status codecov Go Report Card Waffle board

NO MAINTENANCE NOTICE

I don't maintain this repository anymore. Feel free to fork if needed.

Be a rockstar and efficiently manage your team's gitlab.org or self-hosted Gitlab projects, groups, users and other resources.

Tested with Gitlab 11.1.

Getting Started

Complete the installation guide below and then follow the quickstart guide.

If you are hooked, please visit the awesome Project Github site to read the full manual of each command.

If you just want to quickly check what are the available commands, go to Gitlab Commands Available in this page.

Installation

Get the download link of your preferred platform binary from RELEASES.

OSX

GITLABCTL_BIN_DIR=$HOME/.gitlabctl/bin

mkdir -p $GITLABCTL_BIN_DIR && curl -Lo gitlabctl \
 https://github.com/devopsctl/gitlabctl/releases/download/v0.3.0/gitlabctl-darwin-amd64 \
 && chmod +x gitlabctl \
 && mv gitlabctl $GITLABCTL_BIN_DIR

export PATH=$PATH:$GITLABCTL_BIN_DIR

# You can also append this export command in $HOME/.profile or similar SHELL file
# to make sure it is included in your `$PATH` variable 
# automatically upon starting a new terminal session.

Linux

GITLABCTL_BIN_DIR=$HOME/.gitlabctl/bin

mkdir -p $GITLABCTL_BIN_DIR && curl -Lo gitlabctl \
 https://github.com/devopsctl/gitlabctl/releases/download/v0.3.0/gitlabctl-linux-amd64 \
 && chmod +x gitlabctl \
 && mv gitlabctl $GITLABCTL_BIN_DIR

export PATH=$PATH:$GITLABCTL_BIN_DIR

# You can also append this export command in $HOME/.profile or similar SHELL file
# to make sure it is included in your `$PATH` variable 
# automatically upon starting a new terminal session.

Windows

Download the gitlabctl-windows-amd64.exe file, rename it to gitlabctl.exe and add it to your Windows System Environment Variable %PATH%.

Auto Complete

Enable auto complete for bash or zsh shell. ❤️

# follow the instructions from the command output
gitlabctl completion -h

Quickstart

Authenticating to Gitlab server

Using gitlabctl login to fetch personal access token

gitlabctl login

>> Enter gitlab host url: http://localhost:10080
>> Enter gitlab username: root
>> Enter gitlab password: *****
/Users/jb/.gitlabctl.yaml file has been created by login command

Windows Users: password masking does not work in Git bash.

Using environment variables. See gitlabctl -h

Using the help commands

Use -h flag when possible.

gitlabctl [command] -h

or

gitlabctl [command] [subcommand] -h

Usage Examples

Fetching resources with using --output, -o formatter flag.

gitlabctl get groups

+----+------------------+------------------------------------------------+-----------+
| ID |       PATH       |                      URL                       | PARENT ID |
+----+------------------+------------------------------------------------+-----------+
| 13 | Group1           | http://localhost:10080/groups/Group1           |         0 |
| 14 | Group2           | http://localhost:10080/groups/Group2           |         0 |
| 16 | Group1/SubGroup2 | http://localhost:10080/groups/Group1/SubGroup2 |        13 |
| 15 | Group1/SubGroup1 | http://localhost:10080/groups/Group1/SubGroup1 |        13 |
| 17 | Group2/SubGroup3 | http://localhost:10080/groups/Group2/SubGroup3 |        14 |
| 18 | Group2/SubGroup4 | http://localhost:10080/groups/Group2/SubGroup4 |        14 |
+----+------------------+------------------------------------------------+-----------+

View command outout in json.

gitlabctl get groups -o json

[
 {
  "id": 13,
  "name": "Group1",
  "path": "Group1",
  "description": "Updated by go test by id",
  "visibility": "private",
  "lfs_enabled": false,
  "avatar_url": "",
  "web_url": "http://localhost:10080/groups/Group1",
  "request_access_enabled": false,
  "full_name": "Group1",
  "full_path": "Group1",
  "parent_id": 0,
  "projects": null,
  "statistics": null
 },
 {
  "id": 14,
  "name": "Group2",
  "path": "Group2",
  "description": "",
  "visibility": "private",
  "lfs_enabled": true,
  "avatar_url": "",
  "web_url": "http://localhost:10080/groups/Group2",
  "request_access_enabled": false,
  "full_name": "Group2",
  "full_path": "Group2",
  "parent_id": 0,
  "projects": null,
  "statistics": null
 },
 ]

View the command output in yaml.

gitlabctl get groups -o yaml

- avatar_url: ""
  description: Updated by go test by id
  full_name: Group1
  full_path: Group1
  id: 13
  lfs_enabled: false
  name: Group1
  parent_id: 0
  path: Group1
  projects: null
  request_access_enabled: false
  statistics: null
  visibility: private
  web_url: http://localhost:10080/groups/Group1
- avatar_url: ""
  description: ""
  full_name: Group2
  full_path: Group2
  id: 14
  lfs_enabled: true
  name: Group2
  parent_id: 0
  path: Group2
  projects: null
  request_access_enabled: false
  statistics: null
  visibility: private
  web_url: http://localhost:10080/groups/Group2

Create gitlab resources.

# create a group
gitlabctl new group devopsctl

# create a project under devopsctl group
gitlabctl new project gitlab-cli --namespace=devopsctl

# create a new user with username john
gitlabctl new user john --name="John Smith" --password="john123456" --email=john@example.com --reset-password 

Gitlab Commands Available

Authentication

  • Authentication through environment variables.
  • Authentication using gitlabctl login command.

Completion

  • completion --bash
  • completion --zsh

Group

  • get groups [flags]
  • get groups --from-group [flags]
  • describe group [group id or group path] [flags]
  • new group [group name] [flags]
  • delete group [group id or group path]
  • edit group [group id or group path] [flags]

Project

  • get projects [flags]
  • get projects --from-group [flags]
  • describe project [project id or project path]
  • new project [project name] [flags]
  • edit project [project id or project path] [flags]
  • delete project [project id or project path]

Project/Repository Branch

  • get branch [project id or project path] [flags]
  • describe branch [branch name] [--project] [flags]
  • new branch [branch name] [--project] [flags]
  • delete branch [branch name] [--project]
  • edit branch [branch name] [--project] [--protect] [flags]
  • edit branch [branch name] [--project] [--unprotect] [flags]

Project/Repository Tags and Releases

  • get tags [project id or project path] [flags]
  • describe tag [tag name] [--project] [flags]
  • new tag [tag name] [--project] [flags]
  • delete tag [tag name] [--project]
  • new release [tag name] [--project] [flags]
  • edit release [tag name] [--project] [flags]

Project Hooks

  • get project-hooks [project id or project path] [flags]
  • new project-hook [project id or project path] [flags]
  • edit project-hook [hook id] [--project] [flags]
  • delete project-hook [hook id] [--project]

Users

  • get users [flags]
  • describe user [user id or username]
  • new user [username] [flags]
  • delete user [user id or username]
  • edit user [user id or username] [flags]

Users SSH Keys

  • get ssh-keys [flags]
  • new ssh-key [flags]
  • delete ssh-key [flags]

Members

  • get members --from-group [flags]
  • get members --from-project [flags]
  • describe member [username] --from-group [flags]
  • describe member [username] --from-project [flags]
  • new member [username] --from-group [flags]
  • new member [username] --from-project [flags]
  • delete member [username] --from-group
  • delete member [username] --from-project
  • edit member [username] --from-group [flags]
  • edit member [username] --from-project [flags]
  • delete all-members --from-project

Contributing

Contributors are welcomed with love! Please read CONTRIBUTING.md for the process for submitting pull requests to us.