.nh .TH "glab" "1" "Nov 2024" "Auto generated by spf13/cobra" "" .SH NAME .PP glab-token-create - Creates user, group, or project access tokens. .SH SYNOPSIS .PP \fBglab token create [flags]\fP .SH DESCRIPTION .PP Creates a new access token for a user, group, or project. Defaults to a project access token, unless user or group name is specified. .PP The expiration date of the token is calculated by adding the duration (default: 30 days) to the current date. You can specify a different duration, or an explicit end date. .PP The name of the token must be unique. The token is printed to stdout. .PP 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) with the scope 'k8s_proxy'. .SH OPTIONS .PP \fB-A\fP, \fB--access-level\fP=no Access level of the token: one of 'guest', 'reporter', 'developer', 'maintainer', 'owner'. .PP \fB-D\fP, \fB--duration\fP=720h0m0s Sets the token duration, in hours. Maximum of 8760. Examples: 24h, 168h, 504h. .PP \fB-E\fP, \fB--expires-at\fP=0001-01-01 Sets the token's expiration date and time, in YYYY-MM-DD format. If not specified, --duration is used. .PP \fB-g\fP, \fB--group\fP="" Create a group access token. Ignored if a user or repository argument is set. .PP \fB-F\fP, \fB--output\fP="text" Format output as 'text' for the token value, 'json' for the actual API token structure. .PP \fB-R\fP, \fB--repo\fP="" Select another repository. Can use either \fBOWNER/REPO\fR or \fBGROUP/NAMESPACE/REPO\fR format. Also accepts full URL or Git URL. .PP \fB-S\fP, \fB--scope\fP=[read_repository] Scopes for the token. For a list, see https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#personal-access-token-scopes. .PP \fB-U\fP, \fB--user\fP="" Create a personal access token. For the current user, use @me. .SH OPTIONS INHERITED FROM PARENT COMMANDS .PP \fB--help\fP[=false] Show help for this command. .SH EXAMPLE .EX # Create project access token for current project glab token create --access-level developer --scope read_repository --scope read_registry my-project-token # Create project access token for a specific project glab token create --repo user/my-repo --access-level owner --scope api my-project-token # Create a group access token glab token create --group group/sub-group --access-level owner --scope api my-group-token # Create a personal access token for current user glab token create --user @me --scope k8s_proxy my-personal-token # (administrator only) Create a personal access token for another user glab token create --user johndoe --scope api johns-personal-token .EE .SH SEE ALSO .PP \fBglab-token(1)\fP