> ## Documentation Index
> Fetch the complete documentation index at: https://docs.omni.co/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.omni.co/feedback

```json
{
  "path": "/integrations/git/setup/bitbucket-cloud",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Bitbucket Cloud

> Connect a Bitbucket Cloud repository to an Omni model

export const provider_0 = "Bitbucket Cloud"

export const permission1_0 = "Add webhooks to repositories"

export const permission2_0 = "Add SSH keys to user accounts"

<Note>
  Multiple Omni models can share the same git repository. If you're connecting a model to a repository that's already connected to another model, you only need to complete the Omni-side setup—the repository's deploy key and webhooks are already configured.
</Note>

## Requirements

To follow the steps in this guide, you'll need:

* [**Omni Connection Admin permissions**](/administration/users/permissions) for the model you want to connect to git
* **An existing {provider_0} repository**
* **Permissions in {provider_0} that allow you to:**
  * {permission1_0}
  * {permission2_0}

Refer to [Bitbucket's documentation](https://support.atlassian.com/bitbucket-cloud/docs/grant-access-to-a-workspace/) for information about user permissions.

## Setup

<Steps>
  <Step title="Retrieve the repository's SSH URL">
    1. In your browser, navigate to the Bitbucket repository you want to connect to Omni.
    2. Click the **Clone** button near the top right corner of the page.
    3. In the modal that displays, click the **HTTPS** dropdown, then select **SSH**.

    Keep this page open - you'll need it in the next step.
  </Step>

  <Step title="Connect the repository to Omni">
    1. In Omni, click **Develop**.
    2. Click the model you want to connect to git.
    3. In the model IDE, click **Model > Git settings**.
    4. You'll be prompted to enter connection details for the repository:
       * **Authentication Method** - Select **SSH (Deploy Key)** from the dropdown.
       * **SSH URL** - Copy and paste the repository's SSH URL from Step 1.
       * **Base Branch** - Enter the name of the default branch for the repository. Omni will default to `main` unless a different name is specified.
       * **Git follower** - Select this option if the repository should be treated as a [follower](/integrations/git/follower-mode).
    5. Click **Configure Git**.

    The page will update to display additional git settings, including information for deploy keys and webhooks.
  </Step>

  <Step title="Add an SSH key to a service account">
    Bitbucket Cloud access keys are read-only. To allow Omni to push changes, you'll need to add the SSH key to a user account with write access to the repository. We recommend using a service account for this purpose.

    1. Create a service account with write access to the repository.
    2. In the service account, navigate to **Personal Bitbucket settings > SSH keys**.
    3. Click **Add key**.
    4. Fill in the fields as follows:
       * **Label** - Give your new SSH key a descriptive label
       * **Key** - Copy and paste the **Public key** from the Omni **Git settings** page into this field
    5. Click **Add key** to save the key.
  </Step>

  <Step title="Add repository webhooks">
    1. If the repository settings page isn't still open, open it by clicking **Repository settings** in the left navigation.
    2. Click **Webhooks**, located in the **Workflow** section of the left navigation.
    3. Click **Add webhook**.
    4. Fill in the fields as follows:
       * **Title** - Enter a descriptive title, such as *Omni Pull Request Webhook*
       * **URL** - From the Omni **Git settings** page, copy the **Payload URL** and paste it into this field.
       * **Secret** - From the Omni **Git settings** page, copy the **Webhook secret** and paste it into this field.
    5. In the **Triggers** section, select **Choose from a full list of triggers**.
    6. Select only the **Pull Request** events:
       * Pull Request Created
       * Pull Request Updated
       * Pull Request Merged
    7. When finished, click **Save**.
  </Step>

  <Step title="Test the connection">
    To verify the setup, navigate back to the **Git settings** page in Omni. Click the **Test git connection** button near the top of the page to test the connection.
  </Step>
</Steps>

## What's next?

After the setup is complete, you can configure the integration's behavior by changing its settings. Refer to the [git integration settings reference](/integrations/git/settings) for more information.
