---
title: "Bitbucket Server setup"
canonical: "https://support.appfire.com/space/FD/1802371170/Bitbucket%20Server%20setup"
format: markdown
---
> Macro (aura-html)

This is a step-by-step guide on getting started with Bitbucket Server. If your repositories are behind a firewall, [allowlist our IPs](https://appfire.atlassian.net/wiki/spaces/FD/pages/1802469405) on port 443 over HTTPS. You also need a public DNS record pointing to the IP address being exposed for Flow analysis. This DNS entry should match the TLS/SSL certificate the server is utilizing.

> ⚠️ Use a service account to create this integration. Learn more about [creating a service account](https://appfire.atlassian.net/wiki/spaces/FD/pages/1801977900).

## Create your integration

To create your Bitbucket Cloud integration:

1. Click **Settings** in the top navigation.
2. In the left navigation under **Integrations**, click **Integrations**.
3. Click **Add integration**.
4. Click **Bitbucket Server (Self-hosted)** in the Integration Provider list.
5. Optional: If you see the Direct Connection or [Hybrid Connection](https://appfire.atlassian.net/wiki/pages/createpage.action?spaceKey=fd&title=Git%20metadata%20collector&linkCreation=true&fromPageId=1802371170), select one.
6. Next, select your integration method and authenticate with Bitbucket: **Username/Password **or **Access token**.

### Username/Password

Follow the Bitbucket Server's instructions to [create a user](https://confluence.atlassian.com/bitbucketserver/users-and-groups-776640439.html). Set the username and password when creating the user and remember them for later use.

> ⚠️ Do not check the box to email the user with a link to set their password.

Once you've created the user, click **Change permissions**. Search for the user you just created and click **Add**. Give the user access to the API with **repo_read**. Learn more about [Bitbucket Server's global permissions](https://confluence.atlassian.com/bitbucketserver/http-access-tokens-939515499.html). 

1. In the Add credential tab, enter your username, password, and base URL.

![Add credentials tab for integrating bitbucket sever with flow.](media://b2ffb950-17f2-45c6-a07c-dba0fa59868d)

2. Click **Test connection**.

- If the connection was successful, you will see a success message.
- If you receive an error when trying to connect your Bitbucket Server account, verify that the username, password, and base URL are correct.

When your authentication is successful, click **Next** to complete the setup of your integration.

### Access token

1. In the Add credential tab, enter your username, personal access token, and base URL. For more information on where to create an access token in Bitbucket Server, see Bitbucket’s support document, [Personal access tokens](https://confluence.atlassian.com/bitbucketserver0512/personal-access-tokens-955159592.html).

![A screen for integrating bitbucket server via access token.](media://9dad1f94-49f6-47c1-ae49-d1efc1a9c0e0)

2. Click **Test connection**.

- If the connection was successful, you will see a success message.
- If you receive an error when trying to connect your Bitbucket Server account, verify that the username, password, and base URL are correct.
- If you are connected behind a firewall, verify the following:
  - Flow's IP addresses are allowlisted on port 443.
  - A public DNS record is set up and pointing to the exposed IP address for Flow's use.

When you are successfully connected to your Bitbucket Server account, click **Next** to complete the setup of your integration.

## Finish your integration setup

Once you have a successful connection, you can finalize your integration and begin importing repos as outlined below:

1. Click **Next** from the Bitbucket Authentication Method screen.
2. Toggle the **Repos** and **Pull requests** services on or off to determine which data types Flow will ingest for this integration. After you've made your selections, click **Next**.
3. Name your integration. This is the name Flow will display for the integration. Choose a name that will help you identify the integration in the future. Then click **Done**.

You've successfully created a Bitbucket Server integration. Next, Flow directs you to the details page for this integration to complete additional setup steps. At this point, choose whether to [enable auto-import for your repos and set up repo exclusions](https://appfire.atlassian.net/wiki/spaces/FD/pages/1802502278).

### Troubleshooting

- CAPTCHA must be disabled in your Bitbucket Server instance to establish a proper connection to Flow. CAPTCHA turns on automatically when there are failed attempts to authenticate Bitbucket Server.
- If you're having trouble connecting to Bitbucket Server or notice the repos aren't updating, the CAPTCHA may have been activated. Ask your Bitbucket Server administrator to disable the CAPTCHA and try connecting or updating again.