https://github.com/boileaum/gitlab-users
A CLI tool to manage GitLab users.
https://github.com/boileaum/gitlab-users
cli gitlab python user-management
Last synced: 11 months ago
JSON representation
A CLI tool to manage GitLab users.
- Host: GitHub
- URL: https://github.com/boileaum/gitlab-users
- Owner: boileaum
- License: mit
- Created: 2017-10-11T15:29:02.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-02-26T19:42:16.000Z (over 3 years ago)
- Last Synced: 2025-04-22T12:07:59.387Z (about 1 year ago)
- Topics: cli, gitlab, python, user-management
- Language: Python
- Size: 48.8 KB
- Stars: 9
- Watchers: 1
- Forks: 6
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# gitlab-users
[](https://github.com/boileaum/gitlab-users/actions/workflows/ci-publish.yml)
[](https://github.com/boileaum/gitlab-users/releases)
[](https://python.org)
[](https://opensource.org/licenses/MIT)
[](https://github.com/psf/black)
[](https://boileaum.github.io/gitlab-users/)
A CLI and an API to manage GitLab user accounts, based on [python-gitlab](https://github.com/python-gitlab/python-gitlab).
## Features
- List users and groups from a GitLab instance
- Export users to CSV
- Bulk create/delete users from CSV
- Export SSH keys
## Installation
```sh
pip install gitlab-users
```
Requires Python 3.9+ and a valid `python-gitlab` configuration (`~/.python-gitlab.cfg`).
## Usage
Get help and list all commands:
```sh
gitlab-users -h
```
List all users:
```sh
gitlab-users list-users
```
List all groups:
```sh
gitlab-users list-groups
```
Export all users to a CSV file:
```sh
gitlab-users export-users users.csv
```
Create users from a CSV file (see example format below):
```sh
gitlab-users create-from-csv users.csv
```
Delete users from a CSV/text file (usernames in first column):
```sh
gitlab-users delete-from-csv users.csv
```
Delete a single user (asks for confirmation):
```sh
gitlab-users delete-user USERNAME
```
Export SSH keys of a user:
```sh
gitlab-users export-ssh-keys USERNAME
```
### Example CSV format
```text
# username, name, email, [organization], [location], [group], [access_level]
# Note: The fields in square brackets are optional and can be omitted if not needed.
ww,Diana Prince,wonder.woman@themyscira.org,,Themyscira
wayne,Bruce Wayne,bruce.wayne@wayne-enterprises.com,Wayne Enterprises,Gotham City,board,owner
```
## Development
- See [CONTRIBUTING.md](CONTRIBUTING.md) for dev setup, linting, testing, and release instructions.
- Run all tests: `pytest`
- Lint and format: `ruff check .` and `black .`
## Documentation
- Full API and usage documentation: [Sphinx HTML docs](https://boileaum.gitlab-users.pages.gitlab-tools/docs/)
- To build locally:
```sh
cd docs
make html
```
## License
MIT License