Skip to main content
wit provides first-class GitHub integration with OAuth authentication, making it easy to clone, push, and pull from GitHub repositories.

Authentication

The easiest way to authenticate with GitHub:
This will:
  1. Display a URL and a code
  2. Open your browser to GitHub
  3. You enter the code and authorize wit
  4. 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:
  1. Go to GitHub Settings → Developer settings → Personal access tokens
  2. Click “Generate new token (classic)”
  3. Select scopes:
    • repo - Full control of private repositories
    • user:email - Read user email (for commits)
  4. Copy the token
  5. Set it in your environment:

How Authentication Works

Priority Order

wit checks for credentials in this order:
  1. Environment variables (GITHUB_TOKEN, GH_TOKEN)
  2. Stored OAuth credentials (from wit github login)
  3. 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).

Author Information

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:
  1. Token hasn’t expired
  2. Token has correct scopes (repo, user:email)
  3. Token is set correctly:

OAuth Login Fails

If the device flow fails:
  1. Make sure you’re entering the code correctly
  2. Try logging out and in again
  3. Check your internet connection
  4. 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:
  1. Create an OAuth App at github.com/settings/developers
  2. Set the client ID:
This is useful for:
  • Enterprise GitHub instances
  • Custom branding
  • Organizational control over OAuth scopes