Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
G

gitlab

> 开发工具
Open source

Ruby wrapper and CLI for the GitLab REST API

1.1K stars0 likes3 views
WebsiteGitHub

About

Ruby wrapper and CLI for the GitLab REST API

Gitlab

website | documentation | gitlab-live

Gitlab is a Ruby wrapper and CLI for the GitLab API.

Installation

Install it from rubygems:

bash
gem install gitlab

Or add to a Gemfile:

ruby
gem 'gitlab'
# gem 'gitlab', github: 'NARKOZ/gitlab'

Mac OS users can install using Homebrew (may not be the latest version):

bash
brew install gitlab-gem

Usage

Configuration example:

…

(Note: If you are using GitLab.com's hosted service, your endpoint will be https://gitlab.com/api/v4)

Usage examples:

…

For more information, refer to documentation.

CLI

It is possible to use this gem as a command line interface to GitLab. In order to make that work you need to set a few environment variables:

bash
export GITLAB_API_ENDPOINT=https://gitlab.example.com/api/v4
export GITLAB_API_PRIVATE_TOKEN=

# This one is optional and can be used to set any HTTParty option you may need
# using YAML hash syntax. For example, this is how you would disable SSL
# verification (useful if using a self-signed cert).
export GITLAB_API_HTTPARTY_OPTIONS="{verify: false}"

Usage:

When you want to know which CLI commands are supported, take a look at the client commands implemented in this gem. Any of those methods can be called as a command by passing the parameters of the commands as parameters of the CLI.

Usage examples:

…

CLI Shell

Usage examples:

bash
# start shell session
gitlab shell

# list available commands
gitlab> help

# list groups
gitlab> groups

# protect a branch
gitlab> protect_branch 1 master

# passing options hash to a command (use YAML)
gitlab> create_merge_request 4 "New merge request" "{source_branch: 'new_branch', target_branch: 'master', assignee_id: 42}"

Web version is available at https://gitlab-live.herokuapp.com
For more information, refer to website.

Development

With a dockerized GitLab instance

bash
docker-compose up -d gitlab # Will start the GitLab instance in the background (approx. 3 minutes)

After a while, your GitLab instance will be accessible on http://localhost:3000.

Once you have set your new root password, you can login with the root user.

You can now setup a personal access token here: http://localhost:3000/profile/personal_access_tokens

Once you have your token, set the variables to the correct values in the docker.env file.

Then, launch the tool:

bash
docker-compose run app
ruby
Gitlab.users
=> [#1, "name"=>"Administrator", "username"=>"root", ...]

To launch the specs:

bash
docker-compose run app rake spec

Want to use GitLab Enterprise?

Just change the image from gitlab/gitlab-ce:latest to gitlab/gitlab-ee:latest in the docker-compose.yml file.

With an external GitLab instance

First, set the variables to the correct values in the docker.env file.

Then, launch the tool:

bash
docker-compose run app
ruby
Gitlab.users
=> [#1, "name"=>"Administrator", "username"=>"root", ...]

To launch the specs,

bash
docker-compose run app rake spec

Without Docker

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

For more information see CONTRIBUTING.md.

License

Released under the BSD 2-clause license. See LICENSE.txt for details.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Rubygitlabgitlab-apigitlab-cliruby-gem

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 17, 2026
Category开发工具
PricingOpen source

> Related tools

V
VS Code
流行的开源代码编辑器
G
Git
分布式版本控制系统
V
Vite
下一代前端构建工具