Features
- OAuth 2.0 authentication with automatic token refresh
- Support for self-hosted Gitea instances
- Repository and branch browsing
- Automatic token refresh with expiry management
- Internal URL support for same-network deployments
- Lightweight and fast API integration
Prerequisites
- A Gitea instance (self-hosted)
- Access to the repositories you want to deploy
- Admin access to create OAuth applications
- Your Dokploy instance must be accessible for OAuth callbacks
Creating a Gitea OAuth Application
Navigate to Applications
In your Gitea instance:
- Sign in to your Gitea account
- Go to Settings → Applications
- Scroll to “Manage OAuth2 Applications”
- Click Create a new OAuth2 Application
Configure Application Details
Fill in the OAuth application information:Application Name: Choose a descriptive name (e.g., “Dokploy Production”)Redirect URI: Your Dokploy callback URL:
Configuring in Dokploy
Navigate to Git Providers
In Dokploy dashboard:
- Go to Settings → Git Providers
- Click Add Git Provider
- Select Gitea
Enter Configuration
Fill in the Gitea OAuth details:Provider Name: A friendly name (e.g., “Gitea Production”)Gitea URL: Your Gitea instance URLGitea Internal URL (optional): For same-network deploymentsClient ID: The Client ID from GiteaClient Secret: The Client Secret from Gitea
Internal URL improves performance when Dokploy and Gitea are on the same network.
Save and Authorize
- Click Save
- You’ll be redirected to your Gitea instance
- Review the requested permissions
- Click Authorize Application
- You’ll be redirected back to Dokploy
OAuth Scopes
Gitea OAuth applications request these scopes:repo- Full repository accessrepo:status- Repository commit statusread:user- Read user profileread:org- Read organization membership
- List accessible repositories
- Clone repositories
- Read repository branches
- Access user and organization information
Using Gitea in Applications
Deploying from Gitea
Create or Edit Application
When creating/editing an application:
- Set Source Type to “Git”
- Select your Gitea provider
Select Repository
Choose from accessible repositories:
- Format:
owner/repository-name - Includes personal and organization repositories
- Only repositories you have access to are shown
Repository Structure
Gitea repositories are returned in this format:Token Management
Automatic Token Refresh
Dokploy automatically manages token lifecycle:- Expiry Check: Before each operation, checks if token expires within 5 minutes
- Refresh Flow:
- Update Storage: Stores new access and refresh tokens
- Continue Operation: Uses refreshed token automatically
Token Expiration
- Default Expiry: 1 hour (3600 seconds)
- Refresh Buffer: 5 minutes before expiry
- Stored as Unix Timestamp:
expiresAtfield - Automatic Retry: Falls back to existing token if refresh fails
Manual Reauthorization
If automatic refresh fails:- Go to Settings → Git Providers
- Click on your Gitea provider
- Click Reconnect or Reauthorize
- Complete OAuth flow again
API Integration
Repository Listing
Fetches user’s repositories with pagination:- 50 repositories per page (Gitea maximum)
- Automatically fetches all pages
- Includes personal and organization repos
Branch Listing
Fetches branches for a repository:Repository Cloning
Clone command using OAuth token:- OAuth2 token authentication format
- Shallow clone for faster deployments
- Optional submodule support with
--recurse-submodules
Internal URL Configuration
When to Use Internal URLs
Use internal URLs when:- Dokploy and Gitea are on the same network
- Gitea is accessible via internal hostname/IP
- You want to reduce latency and bandwidth
Configuration Example
What Uses Which URL
External URL (giteaUrl):
- OAuth authorization redirect
- OAuth callback validation
- User-facing links
giteaInternalUrl) when set:
- Token exchange
- Token refresh
- API calls (repository, branch listing)
- Git clone operations
HTTP vs HTTPS
- External: Should always use HTTPS for OAuth security
- Internal: Can use HTTP if on trusted network
Troubleshooting
OAuth Authorization Fails
OAuth Authorization Fails
No Repositories Listed
No Repositories Listed
Symptoms: Test connection succeeds but no repositories availableSolutions:
- Check Permissions: Verify you have access to repositories
- Create Test Repository: Create a repo to verify API access
- Test API Manually:
- Review Scopes: Ensure OAuth app has repo scope
Token Refresh Errors
Token Refresh Errors
Symptoms: “Failed to refresh Gitea token” in logsSolutions:
- Check Internal URL: If set, must be accessible from Dokploy server
- Verify Client Secret: Ensure secret is correct
- Test Token Endpoint:
- Reauthorize: Remove and re-add provider
Clone Failures
Clone Failures
Symptoms: “Error: Gitea Provider not found” or “Repository configuration failed”Solutions:
- Verify Configuration:
- Repository name
- Owner/username
- Branch name
- Check Token: Use Test Connection to verify
- Test Git Access:
- Review Logs: Check deployment logs for specific errors
Connection Timeout
Connection Timeout
Symptoms: Requests to Gitea timeout or hangSolutions:
- Check Network: Ensure Dokploy can reach Gitea
- Verify Firewall: Check firewall rules allow connection
- Test Connectivity:
- Use Internal URL: If on same network, configure internal URL
Security Best Practices
1. OAuth Application Security
- Store Client Secret Securely: Never commit to version control
- Rotate Credentials: Periodically regenerate client secret
- Limit Scope: Request only necessary OAuth scopes
- Monitor Access: Review authorized applications regularly
2. Network Security
- Use HTTPS: Always use HTTPS for external Gitea URL
- Internal Network: Isolate internal URL to trusted network
- Firewall Rules: Restrict access to Gitea instance
- Regular Updates: Keep Gitea updated to latest version
3. Token Protection
- Encrypted Storage: Tokens encrypted in Dokploy database
- No Logging: Tokens never logged or displayed
- Automatic Expiry: Tokens automatically refreshed
- Revocation: Removing provider invalidates tokens
4. Access Control
- Repository Permissions: Only accessible repos are shown
- User-Level OAuth: Each Dokploy user has separate OAuth tokens
- Organization Access: Review organization membership
Advanced Configuration
Multiple Gitea Providers
Configure multiple providers for: Different Instances:- Separate OAuth tokens
- Independent repository access
- Isolated configuration
Submodule Support
Enable submodules in your application:- Toggle Enable Submodules in application settings
- Ensure submodule repositories are accessible with same token
- Submodules use the same OAuth token for authentication
Watch Paths for Monorepos
For selective deployments in monorepos:Watch paths currently work with manual deployments. Webhook support coming soon.
API Reference
Authentication Header
All API requests use token authentication:Endpoints Used
User Repositories:Rate Limiting
Gitea has configurable rate limits. Default:- Authenticated requests: 5000 per hour
- Unauthenticated: 60 per hour
Comparison with Other Providers
| Feature | Gitea | GitHub | GitLab |
|---|---|---|---|
| Self-Hosted | ✅ Yes | ❌ No | ✅ Yes |
| OAuth 2.0 | ✅ Yes | ✅ App | ✅ Yes |
| Auto Refresh | ✅ Yes | ✅ Yes | ✅ Yes |
| Webhooks | 🔜 Soon | ✅ Yes | 🔜 Soon |
| Internal URL | ✅ Yes | ❌ N/A | ✅ Yes |
| Lightweight | ✅ Yes | ❌ N/A | ❌ No |
Performance Optimization
1. Use Internal URLs
When on same network:- Reduces latency by 50-200ms
- Avoids external network routing
- Faster token operations
2. Connection Pooling
Dokploy reuses connections for:- Multiple API calls
- Token refresh operations
- Repository browsing
3. Pagination Efficiency
- Fetches 50 repos per page (maximum)
- Parallel page fetching
- Stops when all pages retrieved
Future Enhancements
Planned features for Gitea integration:
- Webhooks: Automatic deployment on push events
- Organization Filtering: Filter repositories by organization
- Deploy Keys: Support for deploy key authentication
- Tag Deployments: Deploy on tag creation
- Pull Request Previews: Preview deployments for pull requests
Next Steps
Deploy an Application
Create your first deployment from Gitea
GitHub Integration
Compare with GitHub integration
GitLab Integration
Compare with GitLab integration
Git Providers Overview
Compare all Git provider options