Skip to main content
DeepWiki-Open can access private repositories across multiple platforms using personal access tokens. This comprehensive guide covers token creation, management, security best practices, and troubleshooting for GitHub, GitLab, and BitBucket.

Overview

Private repository access requires authentication tokens that prove your authorization to access the repository content. DeepWiki supports multiple platforms and token types with different permission models.

GitHub

Classic and fine-grained personal access tokens with repository scope

GitLab

Personal access tokens with read_repository scope

BitBucket

App passwords with repository read permissions

Enterprise

Organization and enterprise-specific considerations

GitHub Access Tokens

GitHub offers two types of personal access tokens with different scopes and capabilities.

Classic Personal Access Tokens

1

Navigate to Token Settings

  1. Go to GitHub.com and sign in
  2. Click your profile picture → Settings
  3. In the left sidebar, click Developer settings
  4. Click Personal access tokensTokens (classic)
Classic tokens provide broad access but are easier to set up for multiple repositories.
2

Generate New Token

  1. Click Generate new tokenGenerate new token (classic)
  2. Enter a descriptive note (e.g., “DeepWiki Documentation Access”)
  3. Set expiration (recommended: 90 days for security)
  4. Select scopes based on your needs:
Required scope: repo
  • Full control of private repositories
  • Includes read/write access to code, issues, pull requests
  • Use when: Accessing private repositories you own or have been granted access to
Required scope: public_repo
  • Access to public repositories only
  • More limited permissions
  • Use when: Only accessing public repositories (DeepWiki works without tokens for public repos)
Additional scope: read:org
  • Read organization membership
  • Required for some organization private repositories
  • Use when: Accessing private repositories owned by organizations
3

Copy and Store Token

  1. Click Generate token
  2. Important: Copy the token immediately - you won’t see it again
  3. Store securely (see security best practices below)
GitHub classic tokens start with ghp_ and are 40 characters long. Never share or commit tokens to code repositories.

Fine-Grained Personal Access Tokens (Beta)

For more granular control over repository access:
1

Create Fine-Grained Token

  1. In Developer settingsPersonal access tokens
  2. Click Fine-grained tokensGenerate new token
  3. Configure token details:
    • Token name: Descriptive name
    • Expiration: 90 days recommended
    • Resource owner: Select your account or organization
2

Select Repository Access

Choose repository access level:
Best for: Specific repositories
  • Click “Selected repositories”
  • Choose specific repositories from dropdown
  • More secure, limited scope
Permissions needed:
  • Repository permissions: Contents (Read)
  • Metadata: Read
3

Configure Permissions

Set minimum required permissions:
Fine-grained tokens provide better security through specific repository and permission selection.

GitHub Enterprise

For GitHub Enterprise Server instances:
Token creation process:
  1. Navigate to your GitHub Enterprise instance
  2. Follow same steps as GitHub.com
  3. Ensure your DeepWiki instance can reach enterprise server
Additional considerations:
  • Network connectivity requirements
  • Certificate trust for self-signed certificates
  • Custom API endpoints configuration
With SAML SSO enabled:
  1. Create personal access token normally
  2. Authorize token for SSO:
    • Go to token settings
    • Click “Configure SSO” next to your organization
    • Click “Authorize”
Enterprise considerations:
  • Organization policies may restrict token creation
  • Admin approval may be required
  • Token expiration policies may be enforced

GitLab Access Tokens

GitLab uses personal access tokens with specific scope-based permissions.

Personal Access Token Creation

1

Access Token Settings

  1. Sign in to GitLab.com or your GitLab instance
  2. Click your avatar → Edit profile
  3. In the left sidebar, click Access Tokens
GitLab tokens are more granular than GitHub classic tokens, allowing precise permission control.
2

Create New Token

  1. Click Add new token
  2. Configure token settings:
    • Token name: Descriptive name (e.g., “DeepWiki Access”)
    • Expiration date: Set appropriate expiration
    • Select scopes: Choose required permissions
For private repository access:
  • read_repository - Clone and pull from repositories
  • ⚠️ read_user - Read user information (optional)
  • ⚠️ read_api - Read API access (if using API features)
Avoid unnecessary scopes:
  • write_repository - Not needed for documentation
  • api - Full API access (too broad)
For group projects:
  • Add read_repository scope
  • Ensure you’re a group member
  • Check group access policies
For specific projects:
  • Token automatically inherits project access
  • No additional configuration needed
  • Respects project visibility settings
3

Generate and Store

  1. Click Create personal access token
  2. Copy the generated token immediately
  3. Store securely with appropriate labels
GitLab tokens start with glpat- followed by 20 characters. They cannot be viewed again after creation.

GitLab Self-Managed

For self-hosted GitLab instances:
Configuration requirements:
  • Same token creation process
  • Verify network connectivity to your GitLab instance
  • Check SSL certificate configuration

BitBucket Access

BitBucket uses app passwords instead of traditional tokens, with different permission models.

App Password Creation

1

Access App Password Settings

  1. Sign in to BitBucket.org
  2. Click your avatar → Personal BitBucket settings
  3. In the left menu, click App passwords
BitBucket app passwords are repository-specific credentials with granular permissions.
2

Create App Password

  1. Click Create app password
  2. Configure password settings:
    • Label: Descriptive name (e.g., “DeepWiki Documentation”)
    • Permissions: Select required access levels
Required permissions:
  • Repositories: Read - Access repository content
  • Pull requests: Read - Access PR information (optional)
  • ⚠️ Issues: Read - Access issues (optional)
Avoid unnecessary permissions:
  • Repositories: Write - Not needed for documentation
  • Repositories: Admin - Administrative access
  • Account - Account-level access
Team repositories:
  • Ensure you have repository access
  • App password inherits team permissions
  • Verify with team administrators
Personal repositories:
  • Full access to your own repositories
  • No additional configuration needed
3

Generate Password

  1. Click Create
  2. Copy the generated app password
  3. Store with username for authentication
BitBucket app passwords are unique strings (not prefixed). You’ll need both your username and app password for authentication.

BitBucket Server/Data Center

For on-premises BitBucket instances:
BitBucket Server uses personal access tokens:
  1. Go to your BitBucket Server instance
  2. Click your avatar → Manage account
  3. Click Personal access tokens
  4. Create token with Repository read permission

Token Security Best Practices

Secure Token Storage

Local development:
Configuration management:
Container secrets:
Kubernetes secrets:
Automated rotation strategy:
  1. Generate new tokens before current ones expire
  2. Test new tokens in staging environment
  3. Update production with new tokens
  4. Revoke old tokens after successful deployment
  5. Monitor for failures and rollback if needed
Rotation schedule:
  • High-security environments: 30-60 days
  • Standard environments: 90 days
  • Development environments: 180 days

Access Control

1

Principle of Least Privilege

Minimize token permissions:
  • Use read-only scopes when possible
  • Avoid admin or write permissions
  • Prefer fine-grained tokens over classic tokens
  • Regular audit of token permissions
Review token permissions quarterly to ensure they match current needs.
2

Network Security

Restrict token usage:
API endpoint protection:
3

Monitoring and Alerting

Token usage monitoring:
Security event logging:

Using Tokens with DeepWiki

API Integration

Direct API calls:

Web Interface Integration

1

Token Input Component

Secure token input:
2

Token Validation

Client-side validation:

Organization and Enterprise Considerations

GitHub Organizations

Common organizational restrictions:
  • Personal access token policies
  • Required two-factor authentication
  • IP allowlists for API access
  • Audit logging requirements
Working with restrictions:
  1. Check organization settings before creating tokens
  2. Request necessary permissions from administrators
  3. Use fine-grained tokens when possible for better compliance
  4. Document token usage for audit purposes
Enterprise GitHub features:
  • Advanced security features
  • Custom SAML/OIDC integration
  • Advanced audit logging
  • Custom policies and restrictions
Token considerations:
  • Shorter token lifetimes
  • Required approval workflows
  • Enhanced monitoring requirements
  • Integration with enterprise identity systems
Best practices:
  1. Coordinate with security teams on token policies
  2. Use service accounts for automated access
  3. Implement token rotation procedures
  4. Monitor token usage closely

GitLab Groups and Projects

GitLab group considerations:
  • Group membership requirements
  • Project-level permissions inheritance
  • Shared runner restrictions
  • Group-level tokens (GitLab Premium+)

Token Management at Scale

Multi-Repository Management

1

Centralized Token Store

Token management system:
2

Automated Token Rotation

Rotation workflow:

Monitoring and Analytics

Track token performance:
Token health checks:

Troubleshooting

Common Issues

Symptom: “Bad credentials” or “Invalid token” errorsDiagnosis checklist:
  1. Token format validation:
  2. Token expiration check:
  3. Permission verification:
Solutions:
  • Generate new token with correct permissions
  • Verify token hasn’t expired
  • Check organization SSO requirements
  • Confirm repository access permissions
Symptom: “Not Found” errors for existing repositoriesCommon causes:
  • Token lacks repository scope
  • Repository is private but token has public-only permissions
  • Organization requires SSO authorization for tokens
  • User doesn’t have repository access
Resolution steps:
  1. Verify repository permissions:
  2. Update token permissions:
    • For GitHub: Add repo scope for private repositories
    • For GitLab: Add read_repository scope
    • For BitBucket: Ensure “Repositories: Read” permission
  3. Handle organization restrictions:
    • Authorize token for SSO if required
    • Request repository access from administrators
    • Use organization-approved tokens
Symptom: “API rate limit exceeded” errorsUnderstanding rate limits:
  • GitHub: 5,000 requests/hour for authenticated requests
  • GitLab: 2,000 requests/minute for personal tokens
  • BitBucket: 1,000 requests/hour for authenticated requests
Mitigation strategies:
Best practices:
  • Implement exponential backoff
  • Cache API responses when possible
  • Use webhooks instead of polling
  • Monitor rate limit headers

Advanced Debugging

1

Enable Debug Logging

API server debugging:
2

Network Diagnostics

Connection testing:
3

Token Analysis Tools

Token inspection utility:

Next Steps

API Authentication

Learn about API-level authentication and security

Security Guide

Implement comprehensive security measures

Production Setup

Deploy with proper token management in production

Troubleshooting

Resolve common issues and get support