Connect Bitbucket Cloud

Let ProofLayer read your Bitbucket Cloud repositories to prove they are private and that their main branch is protected.

15 minYou need: An administrator of your Bitbucket workspace

Before you start

Bitbucket Cloud is where some teams keep their source code. ProofLayer reads each repository’s visibility and branch rules to show that code is private and that changes go through review. ProofLayer only reads. It never changes code or settings.

WordWhat it means
WorkspaceYour company’s space in Bitbucket Cloud. The slug is the first part of its address: acme in bitbucket.org/acme.
Workspace access tokenA long code that lets a program read parts of your workspace. You choose exactly what it may do.
Branch restrictionA Bitbucket rule on a branch, such as “only these people may push directly” or “no force pushes”.

Create the token in Bitbucket

  1. Open your workspace settings

    In Bitbucket choose your workspace, then open Settings → Workspace settings. Under security find Access tokens.

  2. Create a workspace access token

    Press Create workspace access token. Name it “ProofLayer read-only” and choose an expiry.

  3. Choose the permissions

    Tick these scopes:

    Scopes
    Repositories: Read
    Account: Read
    Repositories: Admin (so branch restrictions can be read)

    Bitbucket only shows a repository’s branch restrictions to tokens with the Admin permission. ProofLayer itself makes read-only requests and never changes anything.

  4. Copy the token

    Press Create and copy the token straight away. Bitbucket shows it once.

Give ProofLayer the token

  1. Create the connection

    In ProofLayer go to Connections → New connection. For Provider choose Bitbucket Cloud, give it a Name such as “Engineering Bitbucket workspace”, and enter your Workspace (for example acme).

  2. Paste the token

    Paste it into Access token and press Create.

    ProofLayer stores it encrypted and never shows it again. To replace it later, open the connection and use the Bitbucket access card.

Check that it works

  1. Open the connection in ProofLayer

    Go to Connections, click the connection you just made, and find the card called Bitbucket access.

  2. Press Test access

    ProofLayer makes one small read-only request and shows the answer.

    Success looks like a green Access verified message. A red Access test failed message says what went wrong; see the table at the end of this page.

What ProofLayer reads

  • Whether any repository is public.
  • Whether each repository’s default branch has a rule limiting who can push to it directly.
  • Whether history on the default branch can be rewritten (force push).
  • Whether merging needs at least one approval, and a passing build.
  • Empty repositories (no main branch yet) are skipped for the branch rules, but still checked for being private.

If something goes wrong

What you seeLikely causeWhat to do
Bitbucket refuses the tokenWrong workspace, expired token, or missing scopes.Check the workspace slug and that Repositories: Read and Account: Read are ticked.
Branch rules fail to readThe token lacks the Admin permission on repositories.Create a new token that includes Repositories: Admin.
Repositories are missingThe token covers only some repositories.Use a workspace access token rather than a repository one.
You wanted two-factor evidenceBitbucket does not provide it.Connect the identity provider you sign in with.