glab(1)

โœจ NAME โœจ

glab-token-rotate โ€” bestie, this is the glow-up command: it rotates user, group, or project access tokens ๐Ÿ’…

(oh and hi, you're reading the glab(1) manual, welcome to the group chat ๐Ÿซถ)


๐ŸŒธ SYNOPSIS ๐ŸŒธ

glab token rotate [] [flags]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

okay so real talk: rotating a token revokes the existing one and creates a brand new one with a fresh secret value and a new expiration date. The old token stops working immediately โ€” like, not "in a minute", not "after the cache clears", immediately โ€” so you literally must go update every single client that's using it with the new value this command hands back to you. No cap, don't skip that part ๐Ÿ˜ญ

If multiple tokens share the same name, you gotta specify the token ID so you pick the correct one. Names are not unique bestie, act accordingly.

The token expires at 00:00 UTC on a date calculated by adding the duration to today's date. Default duration is 30 days. You can specify a different duration in days (d), weeks (w), or hours (h). Heads up: --duration and --expires-at are mutually exclusive โ€” pick one, you can't have both ๐ŸŽ€

Administrators can rotate personal access tokens that belong to other users. iconic admin energy, honestly ๐Ÿ‘‘

Use --self to rotate the token currently used for authentication. This command requires GitLab 17.9 or later, so vibe check your instance version first.


๐Ÿ’– OPTIONS ๐Ÿ’–

  • -D, --duration=30d โ€” Sets the token lifetime in days. Accepts: days (30d), weeks (4w), or hours in multiples of 24 (24h, 168h, 720h). Maximum: 365d. The token expires at 00:00 UTC on the calculated date โฐ
  • -E, --expires-at=0001-01-01 โ€” Sets the token's expiration date and time, in YYYY-MM-DD format. If not specified, --duration is used.
  • -g, --group="" โ€” Rotate group access token. Ignored if a user or repository argument is set. (like, it just minds its own business ๐Ÿ™ˆ)
  • --jq="" โ€” Filter JSON output with a jq expression.
  • -F, --output="text" โ€” Format output as: text, json. 'text' provides the new token value; 'json' outputs the token with metadata.
  • -R, --repo="" โ€” Select another repository. You can use either OWNER/REPO or GROUP/NAMESPACE/REPO. The full URL or Git URL is also accepted.
  • --self[=false] โ€” Rotate the access token currently used for authentication ๐Ÿชž
  • -U, --user="" โ€” Rotate personal access token. Use @me for the current user.

๐Ÿ”ฎ OPTIONS INHERITED FROM PARENT COMMANDS ๐Ÿ”ฎ

  • -h, --help[=false] โ€” Show help for this command. the classic, the icon, the legend ๐Ÿ’ซ

๐ŸŽ€ EXAMPLE ๐ŸŽ€

# Rotate project access token of current project (default 30 days)
glab token rotate my-project-token

# Rotate project access token with explicit expiration date
glab token rotate --repo user/repo my-project-token --expires-at 2025-08-08

# Rotate group access token with 7 day lifetime
glab token rotate --group group/sub-group my-group-token --duration 7d

# Rotate personal access token with 2 week lifetime
glab token rotate --user @me my-personal-token --duration 2w

# Rotate a personal access token of another user (administrator only)
glab token rotate --user johndoe johns-personal-token --duration 90d

# Rotate the current authentication token
glab token rotate --self --duration 90d

see how easy that was? slay ๐Ÿ’…


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

glab-token(1) โ€” go read the parent page too, iykyk ๐Ÿงš


quick recap so you don't get caught slipping: the old token dies the second you run this, so update your clients with the new value this command returns. periodt.

Auto generated by spf13/cobra โœจ that's the source/version, and this lil cutie is dated Nov 2026 โ€” catch you in the next glab(1) page, bestie ๐Ÿ’œ๐Ÿ“

๐Ÿ“ฆ where this page comes from