Open navClose nav

Bitbucket

Disclaimer

This guide assumes you already have an existing Bitbucket account and repository with a Jekyll or Hugo project. If you don’t have an existing project, check out our Quick start guide, which contains guides and resources for building your first static site.

Forestry allows you to import your static site through Bitbucket repositories. This allows Forestry to sync any changes made by editors in Forestry to be comitted back to Bitbucket. This also allows developers to work on your website on their local machine, and have all changes by synced back to Forestry.

Currently, in order to use Bitbucket as a source provider, you must use Manual Setup to set up the repository connection.

Getting Started

To set up a site whose code is hosted on Bitbucket, click the Add Site button on your dashboard, and select Bitbucket as a source provider. You will notice that the Quick Setup via OAuth toggle automatically switches off, because Quick Setup is not available for Bitbucket repos.

Setting the Repo Location

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2019/04/add-site-manual-init.png

After you click Next, you will be prompted to enter the repository URL, the branch you wish to import, and (if you are importing a Jekyll or Hugo site,) the config path. The repository URL should be the SSH URL, not the HTTPS URL.

Completing the Connection

After you enter your repo information and click Next, you will be taken to the repository settings screen on your site dashboard. This screen will give you access to the information that needs to be added to your git provider’s settings.

https://res.cloudinary.com/forestry-demo/image/fetch/c_limit,dpr_auto,f_auto,q_80,w_640/https://forestry.io/uploads/2018/08/ssh-settings.png

Setting the Public Key

To add a new key to your Bitbucket repo, navigate to https://bitbucket.org/account/user/$USERNAME/ssh-keys/, where $USERNAME is your Bitbucket username.

Click Add key to add a new key. You can use the Label field to add an identifier for this key so you will know what it’s being used for later on. In the Key field, paste in the public key provided by Forestry. Click the Add key button to save this key.

After setting up the key, navigate back to the site settings in Forestry and click Re-import from Bitbucket. If the key has been set up correctly, this will initiate an import of your site to Forestry.

Setting up the Webhook

To add a webhook to your Bitbucket repository, navigate to https://bitbucket.org/$USERNAME/$REPOSITORY/admin/addon/admin/bitbucket-webhooks/bb-webhooks-repo-admin, substituting $USERNAME and $REPOSITORY for the path to your repository.

Click the Add webhook button to add a new webhook, and insert the webhook URL provided by Forestry in the URL field. Under Triggers, select Repository push and hit the Save button.


Last updated on August 27, 2018