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.
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
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.
Setting the Public Key
To add a new key to your Bitbucket repo, navigate to
$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
$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.
Caught a mistake or want to contribute to the docs? Edit this page on Github!