Skip to main content

Bitbucket


To integrate your Bitbucket repositories with Komment, you will need to mirror them on GitHub.

Steps

  1. First, go to GitHub and create a destination repository.

Crate new GitHub repository

  1. Your destination repository can be empty, but be sure to give it a name and set its visibility (public or private) according to your needs. Once you've filled in the details, click Create repository to proceed.

Populate repository details

  1. Navigate to the Bitbucket repository you want to import into Komment. Using the left-hand side menu, go to Repository settings > Pipelines > Settings.

Navigate to Pipelines settings

  1. Next, navigate to Repository settings > Pipelines > SSH keys.

Navigate to SSH keys

  1. Click on Generate keys.

Click on generate keys

  1. Copy the public key.

Copy the public key

  1. Back in your destination repository on GitHub, head to the Settings menu.

Repository settings

  1. Navigate from Settings > Security > Deploy keys.

Find deploy key

  1. Click on Add deploy key.

Click on add deploy key

  1. Paste the public key into the Key box. You will also need to tick the checkbox to Allow write access. Once done, click on Add key.

Populate key information

  1. Back on Bitbucket, head to Repository settings > Security > Access keys in the repository you want to mirror.

Navigate to Bitbucket security settings

  1. Click on Add key.

Click to add key

  1. Give your new key a name, and paste in the public key you copied in Step 5. Once done, click on Add SSH key.

Create SSH key in BitBucket

  1. Create a bitbucket-pipelines.yml file in your BitBucket repository or add this to your existing file:
pipelines:
default:
- step:
name: Sync GitHub Mirror
image: alpine/git:latest
clone:
enabled: false
script:
- git clone --bare git@bitbucket.org:RepoOrg/RepoName.git
- cd RepoName.git
- git push --mirror git@github.com:RepoOrg/RepoName.git

Once this is pushed, any further pushes to BibBucket will be automatically synced to the GitHub destination repository.

Do note you need to substitute 'RepoName' and 'RepoOrg' with the names of your own repositories. In our worked example, this is the resulting yaml file:

Update your yaml file

  1. You can check if your pipeline ran successfully by navigating to the Pipelines section of your Bitbucket repository. A successful pipeline status will indicate content has been pushed to GitHub.

Example successful pipeline

You can now import the project as normal on Komment.