Skip to content

Connecting Git

deploybase pulls source code from Git repositories to build deployments. Four providers are supported.

ProviderClone URL FormatToken Type
GitHubhttps://github.com/user/repo.gitPersonal access token (classic) or fine-grained
GitLabhttps://gitlab.com/user/repo.gitProject or personal access token
Bitbuckethttps://bitbucket.org/user/repo.gitApp password
Codeberghttps://codeberg.org/user/repo.gitApplication token

Set the Git fields when creating or updating a project:

Terminal window
curl -X PATCH https://api.deploybase.eu/api/v1/projects/PROJECT_ID \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"git_repo_url": "https://github.com/user/repo.git",
"git_provider": "github",
"git_token": "ghp_xxxxxxxxxxxx",
"default_branch": "main"
}'
FieldDescription
git_repo_urlHTTPS clone URL. SSH URLs are not supported.
git_providerOne of: github, gitlab, bitbucket, codeberg
git_tokenAccess token with read permissions on the repository. Stored encrypted.
default_branchBranch that auto-promotes to production on deploy. Default: main

Before saving, verify that deploybase can access the repository:

Terminal window
curl -X POST https://api.deploybase.eu/api/v1/projects/validate-git \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"git_repo_url": "https://github.com/user/repo.git",
"git_provider": "github",
"git_token": "ghp_xxxxxxxxxxxx"
}'

Returns {"valid": true} on success, or a git_error_code explaining the failure (authentication, not found, etc.).

ProviderToken TypeRequired Permission
GitHub (fine-grained)Fine-grained PATContents: Read on target repo
GitHub (classic)Classic PATrepo scope (or public_repo for public repos)
GitLabProject access tokenread_repository scope
GitLabPersonal access tokenread_api scope
BitbucketApp passwordRepositories: Read
CodebergApplication tokenrepository read access

Enabling auto-deploy requires additional permissions to create and manage webhooks:

ProviderToken TypeAdditional Permission Needed
GitHub (fine-grained)Fine-grained PATWebhooks: Read & write on target repo
GitHub (classic)Classic PATAlready covered by repo scope
GitLabProject access tokenapi scope (includes webhooks)
GitLabPersonal access tokenapi scope (not just read_api)
BitbucketApp passwordWebhooks: Read and write
CodebergApplication tokenwrite:repository scope

Without these permissions, git validation will succeed but webhook registration will fail when auto-deploy is enabled.

Private repositories work identically to public ones — provide a token with read access. The token is used only during git clone at build time and is never exposed in build logs.