gitlab-users¶
A CLI and an API to manage GitLab user accounts, based on 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¶
pip install gitlab-users
Requires Python 3.9+ and a valid python-gitlab
configuration (~/.python-gitlab.cfg
).
Usage¶
Get help and list all commands:
gitlab-users -h
List all users:
gitlab-users list-users
List all groups:
gitlab-users list-groups
Export all users to a CSV file:
gitlab-users export-users users.csv
Create users from a CSV file (see example format below):
gitlab-users create-from-csv users.csv
Delete users from a CSV/text file (usernames in first column):
gitlab-users delete-from-csv users.csv
Delete a single user (asks for confirmation):
gitlab-users delete-user USERNAME
Export SSH keys of a user:
gitlab-users export-ssh-keys USERNAME
Example CSV format¶
# 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 for dev setup, linting, testing, and release instructions.
Run all tests:
pytest
Lint and format:
ruff check .
andblack .
Documentation¶
Full API and usage documentation: Sphinx HTML docs
To build locally:
cd docs make html
License¶
MIT License
Table of contents¶
- API Reference
- Changelog
- Version 2.0.1 - 2025-06-05
- Version 2.0.0 - 2025-06-05
- Version 1.0.3 - 2025-06-02
- Version 0.8.7 - 2022-09-21
- Version 0.8.6 - 2022-04-27
- Version 0.8.5 - 2022-01-18
- Version 0.8.4 - 2019-09-12
- Version 0.8.3 - 2019-08-09
- Version 0.8.2 - 2019-03-28
- Version 0.8.1 - 2019-03-28
- Version 0.8 - 2018-11-17
- Version 0.7 - 2018-09-05
- Version 0.6 - 2018-07-06
- Version 0.5 - 2017-10-24
- Version 0.4 - 2017-10-11
- Version 0.3 - 2017-06-12
- Version 0.3 - 2017-06-12