Git Provider Configuration#
Overview#
Git provider configuration in Dokploy links an application or Compose stack to a source repository hosted on GitHub, GitLab, Gitea, or Bitbucket. Each provider has a dedicated frontend form component and a matching tRPC mutation that persists the configuration. The UI lives under the General tab of an application or compose service.
Component Structure#
Each git provider has parallel form components β one for Applications and one for Compose stacks:
| Provider | Application component | Compose component |
|---|---|---|
| GitHub | SaveGithubProvider | SaveGithubProviderCompose |
| GitLab | save-gitlab-provider.tsx | β |
| Gitea | save-gitea-provider.tsx | β |
| Bitbucket | save-bitbucket-provider.tsx | β |
All components follow the same pattern :
- Fetch registered provider accounts via a provider-specific query (e.g.,
api.github.githubProviders) - Derive available repositories and branches lazily from the selected account
- Hydrate form state from the persisted application/compose record on mount via
useEffect+form.reset - Submit via a provider-specific tRPC mutation on save
Form Fields (GitHub)#
The GithubProviderSchema defines the validated fields for an application:
| Field | Type | Notes |
|---|---|---|
githubId | string | ID of the registered GitHub provider account |
repository | { owner, repo } | Cascades to reset branch on change |
branch | string | Validated against VALID_BRANCH_REGEX |
buildPath | string | Default "/" |
triggerType | "push" | "tag" | Default "push" |
watchPaths | string[] | Optional; only shown when triggerType === "push" |
enableSubmodules | boolean | Default false |
The Compose variant uses composePath (default "./docker-compose.yml") instead of buildPath .
Watch Paths#
Watch paths are visible only when triggerType is "push" . When a webhook fires for a push, the deployment is triggered only if changed files match one of the configured glob patterns (e.g., src/**, dist/*.js). Paths are stored as a string[] and can be added by pressing Enter or the + button.
The same field is present on all four providers .
Persistence β tRPC Mutations#
All mutations live in apps/dokploy/server/api/routers/application.ts:
| Provider | Mutation | Line range |
|---|---|---|
| GitHub | saveGithubProvider | |
| GitLab | saveGitlabProvider | |
| Bitbucket | saveBitbucketProvider | |
| Gitea | saveGiteaProvider |
Each mutation:
- Calls
checkServicePermissionAndAccessfor authorization - Updates the application record via
updateApplicationwithsourceTypeset to the provider name andapplicationStatusreset to"idle" - Writes an audit log entry
The input schemas (apiSaveGithubProvider, apiSaveGitlabProvider, etc.) are co-located in packages/server/src/db/schema/application.ts.
Permission Check: canEditDeployGitSource#
Before allowing a user to change the git source of an existing deploy, the server calls canEditDeployGitSource from packages/server/src/services/git-provider.ts. It returns true if the user is an org owner, or if the member owns the provider or the provider is shared org-wide . This is distinct from the permission to trigger deploys.
Key Behavioral Notes#
- Cascading reset: Selecting a new GitHub account clears the repository and branch fields ; selecting a new repository clears the branch .
- Lazy queries: Repository and branch lists are fetched only after their upstream dependency is set β
enabled: !!githubIdfor repositories,enabled: !!owner && !!repo && !!githubIdfor branches . triggerType(push vs. tag) is exposed only on GitHub; GitLab, Gitea, and Bitbucket do not include it in their schemas .- Submodule support (
enableSubmodules) is consistently available across all four providers.