Manage GitHub authentication.
ghx auth <command> [flags]The auth command group provides authentication management for ghx-cli. It integrates with GitHub CLI for seamless authentication with fallback to environment variables.
| Command | Description |
|---|---|
status |
Show authentication status |
Display current authentication status.
ghx auth status [flags]| Flag | Description | Default |
|---|---|---|
--format |
Output format (table, json) | table |
# Check status
ghx auth status
# JSON output
ghx auth status --format jsonThe status command displays:
- GitHub CLI Status: Whether
ghis installed - Environment Token: Whether
GITHUB_TOKENorGHX_TOKENis set - Token Availability: Whether a valid token is available
- Token Validity: Whether the token is valid and not expired
- Available Scopes: Token permission scopes
- Required Scopes: Scopes needed for ghx-cli features
GitHub CLI Authentication Status
================================
Status: Ready
Details:
--------
GitHub CLI: Installed
Environment Token: Not set
Token: Available
Token Validity: Valid
Required Scopes: Available
Available Scopes: [admin:org delete_repo gist project repo workflow]
Required Scopes: [repo project]
Recommendation:
---------------
Authentication is properly configured
ghx-cli automatically uses your GitHub CLI authentication:
# Login with GitHub CLI
gh auth login
# Verify
ghx auth statusSet a GitHub Personal Access Token:
# Using GITHUB_TOKEN
export GITHUB_TOKEN="ghp_your_token_here"
# Or using GHX_TOKEN
export GHX_TOKEN="ghp_your_token_here"Add token to config file (~/.ghx.yaml):
token: "ghp_your_token_here"Pass token directly (not recommended for security):
ghx project list --token "ghp_your_token_here"| Scope | Description | Commands |
|---|---|---|
repo |
Full repository access | All project/item commands |
project |
Project access | All project commands |
| Scope | Description | Commands |
|---|---|---|
read:discussion |
Read discussions | discussion list, discussion view |
write:discussion |
Write discussions | discussion create, discussion edit |
admin:org |
Organization admin | Org-level project management |
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token (classic)"
- Select required scopes:
repo- Full control of private repositoriesproject- Full control of projectswrite:discussion- Read and write discussions
- Copy the token and store it securely
Error: no authentication token available
Solution: Login with GitHub CLI or set environment variable:
gh auth login
# or
export GITHUB_TOKEN="your_token"Error: token is invalid or expired
Solution: Generate a new token or re-authenticate:
gh auth refreshError: token lacks required scope: project
Solution: Generate a new token with required scopes or:
gh auth refresh -s project