GitHub Authentication
ssgo supports GitHub private repositories for template downloads and private organization access.
Token Resolution Order
ssgo looks for authentication in this order:
- Environment Variable -
GITHUB_TOKEN - GitHub CLI - If installed and authenticated (
gh auth token)
Required Permissions
For private repository access, your token needs:
| Scope | Description |
|---|---|
repo | Full control of private repositories |
Setting Up Authentication
Option 1: Environment Variable
bash
# Add to your shell profile (.bashrc, .zshrc, etc.)
export GITHUB_TOKEN="ghp_your_personal_access_token"Option 2: GitHub CLI
bash
# Install GitHub CLI
brew install gh
# Authenticate
gh auth login
# Verify
gh auth tokenCreating a Personal Access Token
- Go to GitHub Settings > Developer settings > Personal access tokens
- Click "Generate new token (classic)"
- Select the
reposcope - Generate and copy the token
- Set it as
GITHUB_TOKENenvironment variable
Fine-grained Tokens
For fine-grained tokens, ensure:
- Repository access: All repositories or specific repos
- Permissions: Contents (Read)
Troubleshooting
Token Not Found
Error: authentication required for private repositorySolution: Ensure GITHUB_TOKEN is set or gh auth login is completed.
Permission Denied
Error: 403 ForbiddenSolution: Verify your token has the repo scope for private repositories.
Token Expired
Personal access tokens can expire. Generate a new token if needed.