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.
Requirements
To follow the steps in this guide, you’ll need:- Omni Connection Admin permissions for the model you want to connect to git
- An existing repository
- Permissions in that allow you to:
Setup
Retrieve the repository's SSH URL
- In your browser, navigate to the Bitbucket repository you want to connect to Omni.
- Click the Clone button near the top right corner of the page.
- In the modal that displays, click the HTTPS dropdown, then select SSH.
Connect the repository to Omni
- In Omni, click Develop.
- Click the model you want to connect to git.
- In the model IDE, click Model > Git settings.
- You’ll be prompted to enter connection details for the repository:
- Git Provider - Select 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
mainunless a different name is specified.
- Click Configure Git.
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.
- Create a service account with write access to the repository.
- In the service account, navigate to Personal Bitbucket settings > SSH keys.
- Click Add key.
- 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
- Click Add key to save the key.
Add repository webhooks
- If the repository settings page isn’t still open, open it by clicking Repository settings in the left navigation.
- Click Webhooks, located in the Workflow section of the left navigation.
- Click Add webhook.
- 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.
- In the Triggers section, select Choose from a full list of triggers.
- Select only the Pull Request events:
- Pull Request Created
- Pull Request Updated
- Pull Request Merged
- When finished, click Save.