wit provides first-class GitHub integration with OAuth authentication, making it easy to clone, push, and pull from GitHub repositories.
Authentication
OAuth Device Flow (Recommended)
The easiest way to authenticate with GitHub:
This will:
- Display a URL and a code
- Open your browser to GitHub
- You enter the code and authorize wit
- wit securely stores your credentials
Check Status
See your current authentication status:
Output:
Logout
Remove stored credentials:
Get Token (For Scripts)
If you need the token for other tools:
Be careful with this command - it outputs your token in plain text.
Only use in secure environments.
Environment Variables
You can also authenticate using environment variables:
Creating a Personal Access Token
If you prefer tokens over OAuth:
- Go to GitHub Settings → Developer settings → Personal access tokens
- Click “Generate new token (classic)”
- Select scopes:
repo - Full control of private repositories
user:email - Read user email (for commits)
- Copy the token
- Set it in your environment:
How Authentication Works
Priority Order
wit checks for credentials in this order:
- Environment variables (
GITHUB_TOKEN, GH_TOKEN)
- Stored OAuth credentials (from
wit github login)
- Git credential helpers (system keychain)
Credential Storage
OAuth credentials are stored in:
- macOS/Linux:
~/.wit/github-credentials.json
- Windows:
%USERPROFILE%\.wit\github-credentials.json
The file is created with restricted permissions (readable only by you).
When you authenticate with GitHub, wit automatically uses your GitHub profile for commit author information:
Common Workflows
Clone Private Repository
Push to GitHub
Fork Workflow
Troubleshooting
”401 Unauthorized”
Your credentials may have expired:
“Permission denied”
Check if you have access to the repository:
Make sure your token has the repo scope for private repositories.
Token Not Working
If using a personal access token, verify:
- Token hasn’t expired
- Token has correct scopes (
repo, user:email)
- Token is set correctly:
OAuth Login Fails
If the device flow fails:
- Make sure you’re entering the code correctly
- Try logging out and in again
- Check your internet connection
- As fallback, use a personal access token
Security Best Practices
Do:
- Use OAuth login when possible (tokens are scoped and can be revoked)
- Set restrictive token scopes
- Rotate tokens periodically
- Use
wit github logout on shared machines
Don’t:
- Commit tokens to repositories
- Share tokens in plain text
- Use tokens with more permissions than needed
Custom OAuth App
For enterprise deployments, you can use your own OAuth App:
- Create an OAuth App at github.com/settings/developers
- Set the client ID:
This is useful for:
- Enterprise GitHub instances
- Custom branding
- Organizational control over OAuth scopes