---
title: "Git sources"
description: "Connect GitHub, GitLab, Bitbucket or Gitea to OnePloy, deploy private repositories, auto-deploy on push and enable preview deployments."
url: https://oneploy.dev/docs/applications/git-sources/
type: op_doc
published: 2026-11-02T19:09:47+00:00
updated: 2026-11-02T19:11:22+00:00
author: "admin"
language: en-US
---

# Git sources

> Connect GitHub, GitLab, Bitbucket or Gitea to OnePloy, deploy private repositories, auto-deploy on push and enable preview deployments.

A Git source tells OnePloy where to fetch your code. Public repositories need no setup. For private repositories, automatic deployments on push and preview deployments, connect a GitHub App or GitLab App under **Git sources**, or use a deploy key with a manual webhook.

## Which option should I use?

| Option | Private repos | Auto deploy on push | Preview deployments |
| --- | --- | --- | --- |
| Public Git Repository | No | With a manual webhook | No |
| GitHub App | Yes | Yes, configured automatically | Yes |
| GitLab App | Yes | Yes, configured automatically | Yes |
| Deploy key (SSH) | Yes | With a manual webhook | No |

Bitbucket and Gitea repositories work as public repositories or with a deploy key, and can trigger deployments through [manual webhooks](https://oneploy.dev/docs/applications/deploy-webhooks/).

## How do I connect GitHub?

1. Open **Git sources** in the sidebar and create a GitHub App.
2. Give it a name and choose whether it belongs to your personal account or an organization.
3. Follow the redirect to GitHub to create and install the app, choosing which repositories it may access.
4. Back in OnePloy, the source shows as connected with its App ID and installation ID.
5. When you add a resource, pick **Git Repository (with GitHub App)**, choose the app, then the repository and branch.

The app subscribes to push and pull request events, so pushes deploy automatically and pull requests can create [preview deployments](https://oneploy.dev/docs/applications/preview-deployments/).

## How do I connect GitLab?

1. Create a GitLab application in your GitLab instance or on gitlab.com.
2. In **Git sources**, add a GitLab source with the GitLab URL, application ID, application secret and a webhook secret token.
3. Add a resource with **Git Repository (with GitLab App)**.

Self-managed GitLab instances are supported, including a custom SSH user and port.

## How do I deploy a private repository with a deploy key?

1. Open **Keys & Tokens** and create or import an SSH private key.
2. Add the matching public key as a read-only deploy key in your Git provider.
3. Add a resource with **Private Git Repository (with Deploy Key)**, choose the key and enter the SSH repository URL and branch.
4. To deploy on push, configure a [manual webhook](https://oneploy.dev/docs/applications/deploy-webhooks/) in your Git provider.

## Repository options

In the application’s advanced settings you can enable Git submodules and Git LFS, set the clone depth, and define watch paths so only changes in certain folders trigger a deployment.

---

Source: https://oneploy.dev/docs/applications/git-sources/ · OnePloy
