# gh auth token

Get the token for scripts and other tools.

## Quick answer
```
gh auth token
```

## Syntax
```
gh auth token [flags]
```

## Examples

# Print the active token
gh auth token

# Export it into an environment variable
export GH_TOKEN=$(gh auth token)

# Token for a specific host
gh auth token --hostname github.example.com

# Log in to a container registry with it
gh auth token | docker login ghcr.io -u USERNAME --password-stdin

## Key flags

  -h, --hostname	Print the token for a specific host.
  -u, --user	Print the token for a specific account on the host.

Full guide: https://ghcli.com/gh-auth-token.php
