Gitea and Forgejo
Coolify can deploy Gitea, Forgejo, and Codeberg repositories through a public HTTPS URL, an SSH deploy key, or a Gitea / Forgejo App. Codeberg runs Forgejo. The steps on this page are the same for Gitea and Forgejo.
| Method | Best for | Repository access |
|---|---|---|
| Public repository | Public source that needs no authentication | HTTPS URL |
| Deploy key | One private repository, or a Gitea or Forgejo instance where an OAuth2 application is unavailable | SSH URL and repository deploy key |
| Gitea / Forgejo App | Private repositories on gitea.com, Codeberg, or a self-hosted Gitea or Forgejo instance | OAuth2 application with repository browsing |
Set up a Gitea App
Gitea App integration is available in Coolify v4.5.0 or above.
The Provider list for Codeberg and Forgejo instances is available in Coolify v4.7.0 or above.
A Gitea / Forgejo App lets Coolify list repositories and branches, clone private source over HTTPS, and receive push and pull-request events. Gitea and Forgejo have no installable apps like GitHub, so a Gitea / Forgejo App is an OAuth2 application that you connect to Coolify.
Add the source in Coolify
Open Sources and select New source > Gitea / Forgejo App.
In Provider, select:
- Gitea.com for gitea.com (the default)
- Codeberg (Forgejo) for codeberg.org
- Self-hosted Gitea or Forgejo for your own instance
For Gitea.com and Codeberg, Coolify fills in the instance URL and the API URL. For a self-hosted instance, enter Instance URL in the Self-hosted Gitea or Forgejo section. Coolify fills in API URL (the instance URL with /api/v1). Change Custom Git user and Custom Git port when the SSH user or port of the instance is not git and 22.
Enter Name. To limit the repositories that Coolify lists, enter comma-separated organization or user names in Organization.
On a self-hosted Coolify instance, enable System wide only when every team must be able to select this source. Otherwise, keep the source scoped to the active team.
Select Continue. Coolify shows the redirect URI for the OAuth2 application.
Create the OAuth2 application in Gitea or Forgejo
In Gitea or Forgejo, open Settings > Applications and go to Manage OAuth2 Applications. An organization owner can create the application in the organization settings, and an administrator can create it in Site Administration > Applications, when one user must not own it.
Create an application with:
- the exact redirect URI that Coolify shows
- Confidential client selected
Save the application, then copy its Client ID and Client secret.
Connect Coolify to Gitea or Forgejo
Go back to the source in Coolify. Enter Client ID and Client secret, then select Save.
Select Connect to Gitea / Forgejo. The instance asks you to authorize the read:user, read:repository, and read:organization scopes. Select Authorize Application.
After the instance sends you back to Coolify, the source shows Connected. Select Test connection to make sure that Coolify can call the API of the instance. Test connection tests the saved settings, so it is disabled while the form has unsaved changes. Save the changes first.
Configure webhooks
Copy Webhook URL and Webhook secret from the connected source.
In Gitea or Forgejo, add a webhook of type Gitea or Forgejo. You can add it in the settings of a user, an organization, or one repository. A user or organization webhook sends events for all repositories of that owner. Set:
- Target URL to the Coolify webhook URL
- HTTP Method to
POSTand POST Content Type toapplication/json - Secret to the Coolify webhook secret
- Push events for branch deployments
- Pull Request events for preview deployments
Coolify accepts the X-Gitea-* and X-Forgejo-* headers. It rejects webhook requests when the signature is missing or does not match the secret.
Deploy a repository
Open a Coolify project, select + New, then select Git Repository (with Gitea / Forgejo App).
Choose the server and the connected Gitea / Forgejo App. Select a repository, select Load repository, choose the branch, then configure and deploy the application.
Make sure that the deployment log imports the selected repository and checks out the requested commit.
Self-hosted network requirements
- Coolify must reach the instance URL to exchange OAuth2 codes, refresh tokens, and call the API. The deployment server must reach it to clone repositories.
- Your browser must reach the instance URL to authorize the application.
- The instance must reach the Coolify webhook URL. By default, Gitea and Forgejo block webhooks to private networks. If Coolify runs on a private address, add it to
ALLOWED_HOST_LISTin the[webhook]section ofapp.ini. - Set
ROOT_URLinapp.inito the URL that you enter in Coolify.
Gitea and Forgejo OAuth2 access tokens expire after one hour. Coolify refreshes them automatically before each API call and clone.
Team access
A member who has access only to some projects, environments, or resources cannot select a team Gitea / Forgejo App for a new application or as the new source of an application. This needs write access on the whole team, in the UI and through the API. An application keeps the source that it already uses.
Use the API
The Gitea App endpoints are available in Coolify v4.7.0 or above.
GET /api/v1/gitea-appslists the Gitea / Forgejo Apps of the team and the system-wide apps.POST /api/v1/applications/private-gitea-appcreates an application from a private repository. Sendgitea_app_uuid, andgit_repositoryasowner/name.gitea_app_uuidinPATCH /api/v1/applications/{uuid}changes the source of an application.
The source must be connected. Create and connect a Gitea / Forgejo App in the UI.
Use a deploy key
Use a deploy key when Coolify only needs one private repository, or when Coolify cannot connect to the instance through OAuth2.
- Add a private key under Keys & Tokens > Private Keys.
- Add its public key in the repository under Settings > Deploy Keys.
- Copy the repository SSH URL, such as
git@gitea.example.com:example/application.git. - In Coolify, create Private Repository (with deploy key) and select the stored key.
Read Deploy keys for the complete setup and security guidance.
Configure a manual Gitea or Forgejo webhook
For an application that you created from a public URL or a deploy key:
- Open Webhooks in the Coolify application.
- Copy the Gitea URL.
- Enter Webhook secret in the Gitea section, then select Save changes.
- In Gitea or Forgejo, open the repository webhook settings.
- Enter the URL and the same secret.
- Enable Push.
- Enable pull-request events when you use preview deployments.
- Open Advanced > Deployment and choose Deploy on push (webhooks) in Auto deploy in Coolify.
Test a push deployment first. Then open or update a pull request and examine Preview Deployments.
