mw gitlab token create
Releasev0.35.0 · cfeceb67
mw gitlab token create <name> [flags]Creates a new access token for a user, group, or project. Defaults to a project access token, unless user or group name is specified.
The expiration date of the token is calculated by adding the duration (default: 30 days) to the current date, with expiration occurring at midnight UTC on the calculated date. You can specify a different duration using days (d), weeks (w), or hours (h), or provide an explicit end date.
The name of the token must be unique. The token is printed to stdout.
Administrators can create full-featured personal access tokens for themselves and for other users.
Non-administrators can create personal access tokens only for themselves (@me). These tokens must use the scope ‘k8s_proxy’. For more information, see the GitLab documentation for the User tokens API.
Options
Section titled “Options”Global options
Section titled “Global options”Examples
Section titled “Examples”# Create project access token for current project (default 30 days)$ glab token create --access-level developer --scope read_repository --scope read_registry my-project-token
# Create project access token with 7 day lifetime$ glab token create --repo user/my-repo --access-level owner --scope api my-project-token --duration 7d
# Create a group access token expiring in 2 weeks$ glab token create --group group/sub-group --access-level owner --scope api my-group-token --duration 2w
# Create a personal access token for current user with 90 day lifetime$ glab token create --user @me --scope k8s_proxy my-personal-token --duration 90d
# (administrator only) Create a personal access token for another user$ glab token create --user johndoe --scope api johns-personal-token --duration 180d
# Create a token with explicit expiration date$ glab token create --access-level developer --scope api my-token --expires-at 2025-12-31See also
Section titled “See also”Page views: —Sessions: —