glab service-account create
Create a service account.
Synopsis
Create a service account for a project or a group.
- Every flag is optional. Without
--name, the account is named “Service account user”. Without--usernameor--email, GitLab generates them. - A custom email address must be confirmed before the account uses it, unless the top-level group has a matching verified domain or email confirmation is turned off on the instance. Until then, the address is shown as the unconfirmed email.
- A service account created in a top-level group can be invited to any group or project on the instance. One created in a subgroup can be invited only to that subgroup and its descendants.
Creating a service account in a subgroup requires GitLab 18.11 or later. Setting --email for a group service account requires GitLab 17.11 or later.
glab service-account create [flags]Examples
# Create a service account for the current project
glab service-account create --name "Release bot"
# Create it with a chosen username and email address
glab service-account create --name "Release bot" --username release-bot --email release-bot@example.com
# Create a service account for a specific project
glab service-account create --name "Release bot" --repo user/my-repo
# Create a group service account
glab service-account create --name "Release bot" --group my-group
# Create a service account and print its ID from a script
glab service-account create --name "Release bot" --output json --jq '.id'
Options
--email string Email address of the service account.
-g, --group group Create a service account for a group instead of a project. Accepts a group ID or full path.
--jq string Filter JSON output with a jq expression.
--name string Name of the service account.
-F, --output string Format output as: text, json. (default "text")
-R, --repo string Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.
--username username The service account's username.Options inherited from parent commands
-h, --help Show help for this command.