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

# Standard Bitbucket integration

> Connect Bitbucket Cloud repositories to env zero to create templates and manage deployments using the Bitbucket App for repository access.

> [!WARNING]
>
> To integrate with Bitbucket, you need the necessary permissions on your Bitbucket workspace/repository. If you do not have those permissions, ask an admin or a different user with those permissions to create the template.

## Prerequisites

Before creating a Bitbucket [template](https://docs.envzero.com/guides/admin-guide/templates.md), you need a Bitbucket VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new Bitbucket connection.

Learn more: [Managing VCS Connections](https://docs.envzero.com/guides/admin-guide/manage-vcs.md#centralized-management)

## New Template

If you would like to create your first Bitbucket Integrated Template in this env zero organization, please see **[Create your first template](https://docs.envzero.com/guides/getting-started/create-your-first-template.md)** instead.

**1. Create Template**

Click **ADD A NEW TEMPLATE** on the top right in the *Templates* screen. Pick your template type, enter a name for the template, and then click **NEXT**.

**2. Select Bitbucket**

Click on the **Bitbucket.org** button.

**3. Select VCS Connection**

Select a pre-configured Bitbucket VCS connection from the dropdown. If no connection exists, click **Add VCS Connection** to create one.

**4. Select Repository**

Pick the repository containing your IaC configuration.

**5. Configure Source**

If you would like to pull the code from a specific revision or branch, enter that in the `Revision` field. Leaving this field empty will use your default branch, which is usually "master"/"main".

Enter the folder your IaC files are located in under `Terraform Folder` or `Terragrunt Folder`. If your IaC files are in the root of the repository, leave this empty.

**6. Configure Variables**

Click **NEXT** to proceed to the variables section. Add environment and IaC variables that you'd like to be used during deployment, and then click **NEXT** to go to the final "Projects" section.

**7. Assign Projects**

Pick the projects that you'd like to have access to deploy this template, and then click **DONE** to create the template.

> [!WARNING]
>
> Troubleshooting
>
> * Can't find your repository? Verify that the VCS connection has access to the necessary Bitbucket workspace/repository. You can check the available repositories in **Organization Settings > VCS** by selecting the relevant connection.

## Existing Template

If you would like to integrate an existing template with Bitbucket:

1. Go to the **Templates** screen, and click on **Settings** for the template you would like to integrate with Bitbucket.
2. Click on the **VCS** step. From there you can click on the **Bitbucket.org** button, and integrate with Bitbucket as you would for a new template.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.