Connect a Polaris project to a Bitbucket repository

Black Duck Polaris Platform

This procedure describes how to connect an existing Polaris project to a Bitbucket (Cloud or Data Center) repository.

Before you begin, review Integrate Bitbucket with Polaris. If you're using Bitbucket Data Center, that topic explains how to make sure Polaris has network access to your Bitbucket instance.

Note: SCA Fix Pull Requests are supported for repositories hosted in Bitbucket Cloud and Bitbucket Data Center. For Bitbucket Data Center integrations, Polaris creates the pull request over the Secure Tunnel that connects it to your repository. See SCA Fix Pull Requests.

Bitbucket Data Center: Create an HTTP access token

Authentication between Bitbucket Data Center and Polaris uses an HTTP access token (personal access token) that you create in Bitbucket. Follow the steps below or the instructions in the Bitbucket Data Center documentation: HTTP access tokens > Create HTTP access tokens.

  1. Log in to Bitbucket Data Center.
  2. Select the profile icon (near the upper-right corner of the screen) and open Manage account.
  3. On the left tab, click HTTP access tokens and click Create token.
  4. Name your token.
  5. Set Project permissions to PROJECT_ADMIN.
    Note: The required repository permissions (Repository Admin) are automatically inherited from the project permissions.
  6. Set the token's expiration date. To avoid issues, we recommend Do not expire.
Important: Store your token in a secure location. Each time you modify an integration, you will need to reenter the token to save your changes.

Bitbucket Cloud: Create an API token

Authentication between Bitbucket Cloud and Polaris is managed with an API token that you create in Bitbucket. If you haven't done so already, use the following instructions to create an API token, or refer to Bitbucket Cloud's own documentation: Create an API token.

Note: App passwords have been deprecated for Bitbucket Cloud. Existing projects integrated using App Password will continue to work until the password expires or Atlassian ends support. After your App Password stops working or if creating a new integration, use API tokens.
  1. Select the Settings gear icon in the upper-right corner of the top navigation bar.
  2. Under Personal settings, select Atlassian account settings.
  3. From the Atlassian Account page, select the Security tab on the top navigation bar.
  4. Select Create and manage API tokens.
  5. Select Create API token with scopes.
  6. Give the API token a name and an expiry date. 365 days is recommended, then select Next.
  7. Select Bitbucket as the app and select Next.
  8. Under the Read scopes section, select read:repository:bitbucket and select Next.
  9. Select the Create token button.

    The page will display the New API token.

  10. Copy the generated API token and store it in a secure location.
Important: The token is only displayed once and cannot be retrieved later. Store it in a secure location. Each time you modify a project's SCM integration, you will need to reenter the token to save your changes.

Connect to a repository in Bitbucket

  1. In Polaris, open the project you wish to connect to a repository (go to Portfolio, select an application, and then select a project).
  2. Select Settings > Integrations.
  3. Under Connected SCM, select Edit.
  4. Select the type of server hosting your repository:
    • Cloud-hosted — for Bitbucket Cloud
    • Self-hosted — for Bitbucket Data Center
  5. Select Bitbucket.
  6. (Bitbucket Cloud only) Enter your Email (Bitbucket Account Email).
  7. Enter the Repository URL.

    To obtain the repository URL, open your Bitbucket repository in a browser and select Clone. Copy the HTTPS URL (SSH is not supported) starting at https.



  8. (Bitbucket Data Center only) If you're using the Secure Tunnel, check URL is in a private network and select a secure tunnel from the pull-down menu.
  9. Under Repository Access Token, enter the token you created in Bitbucket.
  10. Click Test Connection. A spinning circle indicates the test is in progress.
  11. If your connection is successful, click Save.

    If your connection test is unsuccessful, check the following and retry:

    1. That your network connection is stable.
    2. That the Repository Access Token is accurate.
    3. That the Repository Access Token is still valid and has not expired.
    4. That you selected the correct provider and hosting type for your SCM.
    5. That you have authorized the access token for use outside SSO (if applicable).
    6. (Bitbucket Data Center only) That Polaris external IP addresses have been added to your firewall allow list, or that the Secure Tunnel is correctly configured.

Next steps