Features
- GitHub App authentication with installation-based access
- Automatic webhook configuration
- Support for push, tag, and pull request events
- Preview deployments for pull requests
- Collaborator permission validation
- Submodule support
Prerequisites
- A GitHub account (personal or organization)
- Admin access to the repositories you want to deploy
- Your Dokploy instance must be accessible from the internet for webhooks
Creating a GitHub App
Navigate to GitHub Settings
Go to your GitHub account or organization settings:
- Personal Account: Settings → Developer settings → GitHub Apps → New GitHub App
- Organization: Settings → Developer settings → GitHub Apps → New GitHub App
Configure Basic Information
Fill in the GitHub App details:GitHub App name: Choose a unique name (e.g.,
Dokploy-Production)Homepage URL: Your Dokploy instance URL (e.g., https://dokploy.yourdomain.com)Webhook URL: https://your-dokploy-domain.com/api/deploy/githubSet Webhook Secret
Generate a secure webhook secret:Save this secret - you’ll need it when configuring the provider in Dokploy.
Configure Permissions
Set the following repository permissions:
| Permission | Access | Purpose |
|---|---|---|
| Contents | Read | Clone repositories |
| Metadata | Read | Access repository information |
| Pull requests | Read & Write | Preview deployments and comments |
| Issues | Read & Write | Post deployment status comments |
| Administration | Read | Check collaborator permissions |
Administration permission is only needed if using preview deployment security features.
Set Installation Location
Choose where the app can be installed:
- Only on this account: Restricts to your account/organization
- Any account: Allows installation on any GitHub account
Generate Private Key
After creation:
- Scroll to “Private keys” section
- Click Generate a private key
- Save the downloaded
.pemfile securely
Installing the GitHub App
Install the App
- Go to your GitHub App settings page
- Click Install App in the left sidebar
- Select the account to install on
- Choose repository access:
- All repositories: Grant access to all current and future repos
- Only select repositories: Choose specific repositories
Configuring in Dokploy
Navigate to Git Providers
In Dokploy dashboard:
- Go to Settings → Git Providers
- Click Add Git Provider
- Select GitHub
Enter Configuration
Fill in the GitHub App details:Provider Name: A friendly name (e.g., “GitHub Production”)GitHub App Name: Your GitHub App nameApp ID: The App ID from GitHubClient ID: The Client ID from GitHubClient Secret: The Client Secret from GitHubInstallation ID: The installation ID from the installation URLPrivate Key: Paste the entire contents of the Webhook Secret: The webhook secret you generated
.pem fileTest Connection
Click Test Connection to verify:
- Private key is valid
- Installation ID is correct
- App has access to repositories
The test displays the number of accessible repositories.
Using GitHub in Applications
Deploying from GitHub
Create or Edit Application
When creating a new application or editing an existing one:
- Set Source Type to “Git”
- Select your GitHub provider from the dropdown
Select Repository
Choose from your accessible repositories:
- Repositories appear as
owner/repository-name - Only repositories the App has access to are shown
Preview Deployments
Enable preview deployments for pull requests:Enable Preview Deployments
In your application settings:
- Toggle Preview Deployments
- Set Preview Limit: Maximum concurrent preview deployments (e.g., 5)
Configure Security (Recommended)
Require Collaborator Permissions: When enabled, only users with write/maintain/admin access can trigger preview deployments.When a non-collaborator opens a PR, Dokploy:
- Blocks the deployment
- Posts a security notification comment
- Provides instructions for resolution
Label Filtering (Optional)
Restrict previews to PRs with specific labels:Only PRs with these labels trigger preview deployments.
Preview Deployment Flow
When a PR is opened/updated:
- Dokploy validates permissions (if enabled)
- Creates a preview deployment
- Posts a comment with deployment status
- Updates the comment when deployment completes
- Includes a link to the preview URL
Webhook Events
Push Events
Triggered when commits are pushed to a branch:- Repository name and owner
- Branch name
- Watch paths (if configured)
Tag Events
Triggered when tags are created:triggerType: tag deploy automatically.
Pull Request Events
Triggered on PR actions (opened, synchronize, reopened, closed):Troubleshooting
Webhooks Not Triggering
Webhooks Not Triggering
- Check Webhook URL: Ensure it’s publicly accessible
- Verify Webhook Secret: Must match in GitHub and Dokploy
- Check Recent Deliveries: In GitHub App settings → Advanced → Recent Deliveries
- Review Response Codes:
200: Success401: Invalid webhook secret400: Missing installation or configuration error
Cannot Access Repositories
Cannot Access Repositories
- Verify Installation: Check the app is installed on the correct account
- Check Repository Access: Ensure specific repos are selected if not using “All repositories”
- Reinstall App: Sometimes reinstallation resolves access issues
- Test Connection: Use the “Test Connection” button in Dokploy
Private Key Errors
Private Key Errors
- Check Format: Ensure the entire key including headers is pasted:
- No Extra Whitespace: Remove trailing spaces or newlines
- Regenerate if Needed: Generate a new private key if corrupted
Preview Deployments Not Created
Preview Deployments Not Created
- Check Base Branch: Preview deployments match the base branch, not the PR branch
- Verify Labels: If using label filtering, ensure PR has required labels
- Check Limit: Preview limit might be reached
- Review Permissions: If security is enabled, verify contributor has write access
Submodules Not Cloning
Submodules Not Cloning
- Enable Submodules: Toggle “Enable Submodules” in application settings
- Check Submodule Access: Ensure GitHub App has access to submodule repositories
- Use HTTPS URLs: Submodules should use HTTPS, not SSH URLs
Security Best Practices
1. Webhook Secret
- Use a strong, randomly generated secret (minimum 32 characters)
- Never commit the secret to version control
- Rotate periodically (update in both GitHub and Dokploy)
2. Repository Access
- Grant access only to necessary repositories
- Use “Only select repositories” when possible
- Review and audit access regularly
3. Preview Deployment Security
- Always enable Require Collaborator Permissions for preview deployments
- Review the security notification system is working
- Monitor who has write access to repositories
4. Private Key Protection
- Store the
.pemfile securely offline - Never share or commit private keys
- Use separate GitHub Apps for production and development
5. Principle of Least Privilege
- Only enable required webhook events
- Grant minimum necessary permissions
- Create separate apps for different environments
Advanced Configuration
Multiple GitHub Apps
You can configure multiple GitHub providers:- Production App: For production repositories
- Development App: For staging/dev repositories
- Organization Apps: Separate apps per organization
- Access permissions
- Webhook configurations
- Rate limits
Watch Paths for Monorepos
For monorepo deployments:Custom Deployment Comments
Preview deployment comments include:- Application name
- Deployment status (Building, Done, Failed)
- Preview URL with clickable link
- Timestamp (UTC)
API Reference
The GitHub integration uses these API endpoints:Repository Listing
Branch Listing
Permission Check
Next Steps
Deploy an Application
Create your first deployment from GitHub
Preview Deployments
Enable PR preview environments
Docker Compose
Deploy multi-container applications
Git Providers Overview
Compare all Git provider options