Created personal access tokenToken: wit_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0Make sure to copy your token now.You will not be able to see it again!Name: CI TokenScopes: repo:read, repo:writeExpires: 2024-04-15Use this token in the Authorization header: Authorization: Bearer wit_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6q7r8s9t0
Save your token immediately after creation. For security reasons, the full token is only shown once and cannot be retrieved later.
Personal Access Tokens (3)wit_a1b2... CI Token ID: abc12345 Scopes: repo:read, repo:write Last used: 2 hours ago • Expires: Apr 15, 2024wit_c3d4... [EXPIRED] Old Deploy Key ID: def67890 Scopes: repo:read Never used • Expired: Mar 1, 2024wit_e5f6... Local Development ID: ghi11223 Scopes: repo:read, repo:write, user:read Last used: 5 minutes ago • Expires: Never
Available Token Scopesrepo:read Clone and pull repositoriesrepo:write Push to repositoriesrepo:admin Manage repository settings, collaborators, and deletionuser:read Read your profile informationuser:write Update your profile
# In your .gitconfig or via git configgit config --global credential.helper store# Then use your token as the password when prompted# Username: your-email@example.com# Password: wit_a1b2c3d4...
Set expiration dates for tokens, especially those used in CI/CD:
Copy
wit token create "CI" --expires 30
Use minimal scopes
Only grant the permissions the token actually needs:
Copy
# Bad: Full access when you only need to readwit token create "Read" -s repo:read,repo:write,repo:admin# Good: Only the required scopewit token create "Read" -s repo:read
Rotate tokens regularly
Create new tokens and revoke old ones periodically:
Copy
wit token create "New CI Token" --expires 30wit token revoke old-token-id
Never commit tokens
Use environment variables or secret management tools instead of hardcoding tokens in code.
Revoke unused tokens
Regularly audit and revoke tokens that are no longer needed:
# Create a CI token with 90-day expirationwit token create "GitHub Actions" --expires 90 --scopes repo:read,repo:write# Save the token as a GitHub secret: WIT_TOKEN# In your workflow:# env:# WIT_TOKEN: ${{ secrets.WIT_TOKEN }}
#!/bin/bash# deploy.sh# Token is set via environmentif [ -z "$WIT_TOKEN" ]; then echo "Error: WIT_TOKEN not set" exit 1fi# Use token for API callscurl -H "Authorization: Bearer $WIT_TOKEN" \ https://wit.example.com/api/repos/myorg/myrepo/releases
# Create new tokenwit token create "CI Token v2" -e 30 -s repo:read,repo:write# Update your CI secrets with the new token# List tokens to find the old onewit token list# Revoke the old tokenwit token revoke old-token-id
Database connection: Set DATABASE_URL environment variable
User authentication: Set WIT_USER_ID environment variable
Copy
# Example setupexport DATABASE_URL=postgresql://wit:wit@localhost:5432/witexport WIT_USER_ID=your-user-id# Now token commands will workwit token create "My Token"
When using wit up to start the platform, these are configured automatically. The WIT_USER_ID can be obtained from the web UI after logging in.