{"id":21441933,"url":"https://github.com/clns/gitlab-cli","last_synced_at":"2025-07-14T17:32:31.708Z","repository":{"id":67664426,"uuid":"57085412","full_name":"clns/gitlab-cli","owner":"clns","description":"CLI tool for GitLab (no prerequisites required)","archived":false,"fork":false,"pushed_at":"2017-07-10T08:49:42.000Z","size":36,"stargazers_count":101,"open_issues_count":6,"forks_count":32,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-06-20T12:37:59.423Z","etag":null,"topics":["cli-command","gitlab","labels"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clns.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-04-26T00:32:43.000Z","updated_at":"2024-03-19T04:41:15.000Z","dependencies_parsed_at":"2023-02-23T06:01:08.042Z","dependency_job_id":null,"html_url":"https://github.com/clns/gitlab-cli","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clns%2Fgitlab-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clns%2Fgitlab-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clns%2Fgitlab-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clns%2Fgitlab-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clns","download_url":"https://codeload.github.com/clns/gitlab-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225990488,"owners_count":17556153,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli-command","gitlab","labels"],"created_at":"2024-11-23T01:45:14.585Z","updated_at":"2024-11-23T01:45:15.171Z","avatar_url":"https://github.com/clns.png","language":"Go","readme":"# gitlab-cli [![Build Status](https://travis-ci.org/clns/gitlab-cli.svg?branch=master)](https://travis-ci.org/clns/gitlab-cli)\n\nCLI commands for performing actions against GitLab repositories.\n\n- [Installation](#installation)\n- [Usage](#usage)\n  - [Labels](#labels)\n    - [Copy global labels](#copy-global-labels-into-a-repository)\n    - [Copy labels from repoA to repoB](#copy-labels-from-repoa-to-repob)\n    - [Update labels](#update-labels-that-match-a-regex)\n    - [Delete labels](#delete-labels-that-match-a-regex)\n  - [Specifying a repository](#specifying-a-repository)\n  - [The config file](#the-config-file)\n- [Development](#development)\n\n## Installation\n\nFollow the instructions from the [releases page](https://github.com/clns/gitlab-cli/releases).\n\n## Usage\n\nFor all available commands see the command's help: `gitlab-cli -h`. The most common commands are documented below.\n\n### Labels\n\n#### Copy global labels into a repository\n\nGitLab Limitation: Currently there's no way to [access global labels through the API](https://twitter.com/gitlab/status/724619173477924865), so this tool provides a workaround to copy them.\n\n```sh\ngitlab-cli label copy -U https://gitlab.com/\u003cUSER\u003e/\u003cREPO\u003e -t \u003cTOKEN\u003e\n```\n\n\u003e Tip: To avoid specifying `-U` and `-t` every time you refer to a repository, you can use the config file to save the details of it. See [Specifying a repository](#specifying-a-repository).\n\n#### Copy labels from repoA to repoB\n\n```sh\ngitlab-cli label copy --from \u003crepoA\u003e -r \u003crepoB\u003e\n```\n\nrepoA and repoB are repository names saved in the [config file](#specifying-a-repository).\n\n\u003e Tip: For repositories on the same installation, you can specify the `--from` repo as `group/repo`, as a convenience, in which case the repository is considered on the same GitLab instance as the target repo.\n\n#### Update labels that match a regex\n\n```sh\ngitlab-cli label update -r \u003cNAME\u003e --match \u003cREGEX\u003e --name \u003cNAME\u003e --color \u003cCOLOR\u003e --description \u003cDESC\u003e\n```\n\n\u003e Note: `\u003cREGEX\u003e` is a Go regex string as in \u003chttps://golang.org/pkg/regexp/syntax\u003e and `\u003cNAME\u003e` is a replacement string as in \u003chttps://golang.org/pkg/regexp/#Regexp.FindAllString\u003e.\n\n#### Delete labels that match a regex\n\n```sh\ngitlab-cli label delete -r \u003cNAME\u003e --match \u003cREGEX\u003e\n```\n\n### TODO\n\nOther commands can be added as needed. Feel free to open pull requests or issues.\n\n### Specifying a repository\n\nThere are 2 ways to specify a repository:\n\n1. By using the `--url (-U)` and `--token (-t)` flags (or `--user (-u)` and `--password (-p)` instead of token) with each command. This is the easiest to get started but requires a lot of typing.\n2. By saving the repository details in the config file and referring to it by its saved name using `--repo (-r)` (e.g. `-r myrepo`)\n\nExample:\n\nInstead of this:\n\n```sh\ngitlab-cli label copy -U https://git.my-site.com/my_group/my_repo -t ghs93hska\n```\n\nyou can first save the repo in the config file and refer to it by name on all subsequent commands:\n\n```sh\ngitlab-cli config repo save -r myrepo -U https://git.my-site.com/my_group/my_repo -t ghs93hska\ngitlab-cli label copy -r myrepo\n```\n\n#### Using user and password instead of token\n\nYou can specify your GitLab login (user or email) - `--user (-u)` - and password - `--password (-p)` - instead of the token in any command, if this is easier for you. Example:\n\n```sh\ngitlab-cli config repo save -r myrepo -U https://git.my-site.com/my_group/my_repo -u my_user -p my_pass\n```\n\n### The config file\n\nThe default location of the config file is `$HOME/.gitlab-cli.yaml` and it is useful for saving repositories and then refer to them by their names. A sample config file looks like this:\n\n```yaml\nrepos:\n  myrepo1:\n    url: https://git.mysite.com/group/repo1\n    token: Nahs93hdl3shjf\n  myrepo2:\n    url: https://git.mysite.com/group/repo2\n    token: Nahs93hdl3shjf\n  myother:\n    url: https://git.myothersite.com/group/repo1\n    token: OA23spfwuSalos\n```\n\nBut there's no need to manually edit this file. Instead use the config commands to modify it (see `gitlab-cli config -h`). Some useful config commands are:\n\n- `gitlab-cli config cat` - print the entire config file contents\n- `gitlab-cli config repo ls` - list all saved repositories\n- `gitlab-cli config repo save ...` - save a repository\n- `gitlab-cli config repo show -r \u003crepo\u003e` - show the details of a saved repository\n\n## Development\n\nYou'll need a [Go dev environment](https://golang.org/doc/install).\n\n```sh\ngit clone https://github.com/clns/gitlab-cli\ncd gitlab-cli\ngit submodule --init update\n```\n\n### Build\n\n```sh\ngo run build/build.go\n```\n\nThis will build all the executables into the [build/](build) directory.\n\n### Test\n\nYou need to provide a GitLab URL and private token to be able to create temporary repositories for the tests.\n\n```sh\nGITLAB_URL=\"\u003cURL\u003e\" GITLAB_TOKEN=\"\u003cTOKEN\u003e\" go test -v ./gitlab\n```\n\nYou can spin up a GitLab instance using [Docker](https://www.docker.com/):\n\n```sh\ndocker pull gitlab/gitlab-ce\ndocker run -d --name gitlab -p 8055:80 gitlab/gitlab-ce\nsleep 60 # allow enough time for GitLab to start\ndocker exec -ti gitlab bash\nsu gitlab-psql\n/opt/gitlab/embedded/bin/psql --port 5432 -h /var/opt/gitlab/postgresql -d gitlabhq_production -c \" \\\n          INSERT INTO labels (title, color, template, description, description_html) VALUES ('feature', '#000000', true, 'represents a feature', 'represents a \u003cb\u003efeature\u003c/b\u003e'); \\\n          INSERT INTO labels (title, color, template, description, description_html) VALUES ('bug', '#ff0000', true, 'represents a bug', 'represents a \u003cb\u003ebug\u003c/b\u003e'); \\\n          UPDATE users SET authentication_token='secret' WHERE username='root';\"\n\n# Note: you may need to change GITLAB_URL to point to your docker container.\n# 'http://docker' is for Docker beta for Windows. \nGITLAB_URL=\"http://localhost:8055\" GITLAB_TOKEN=\"secret\" go test -v ./gitlab\n```\n\n### Vendored dependencies\n\nAll external dependencies should be available in the [vendor/](vendor) directory.\n\nTo list all dependencies run `go list -f '{{.ImportPath}}:{{\"\\n\"}}  {{join .Imports \"\\n  \"}}' ./...`.\n\nTo vendor a package run `git submodule add https://github.com/google/go-github vendor/github.com/google/go-github`.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclns%2Fgitlab-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclns%2Fgitlab-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclns%2Fgitlab-cli/lists"}