Backup Bitbucket Cloud Git repositories

Platform Notice: Cloud Only - This article only applies to Atlassian apps on the cloud platform.

Summary

  • The purpose of this KB article is to provide instructions for performing repository backups, both on a per-repository basis as well as in bulk.

  • As per our backup policy, we perform hourly snapshot backups of your repositories and store these in AWS. Our support team is able to restore your core repository content within a 7-day window of data loss.

Solution

Single repository backup

If you are seeking to perform a local backup of a singular (or a few) repositories, this can most simply be achieved by performing a mirror clone.

  • A mirror clone is a complete backup clone of your repository; it contains the full commit history, all the extended refs of the remote repository, and maintains remote branch tracking configuration. A mirror clone is a bare repo, so it has no working directory.

  • To perform a mirror clone, you would simply add the --mirror flag to your regular clone command against the repository that you wish to backup:

    // Clone via SSH git clone --mirror git@bitbucket.org:workspaceID/repositoryslug.git // Clone via HTTPS git clone --mirror https://username@bitbucket.org/workspaceID/repositoryslug.git

    Replace in the commands above:

    • workspaceID with the ID of the workspace where your repo belongs.

    • repositoryslug with the slug of your repository.

    • username with the username of your Bitbucket Cloud account, that you can find here: https://bitbucket.org/account/settings/.

      •  If you use the command to clone via HTTPS, you will also be asked for a password (unless a credential manager on your computer has an app password already stored). Your account's password will not work; you will need to generate an app password and use that instead of a password. Repositories - Read permissions for the app password are sufficient.

Bulk repository backup

If you are seeking to perform a local backup of all of your remote repositories, this can be achieved in bulk by making use of a script, for example:

NOTE: This is a third-party script that is not formally supported by Atlassian, if you encounter any issues we will not be able to provide scripting assistance as this falls outside of our support scope. We would suggest having your team review this before executing it in production.

We have an unofficial script that can be used to handle this, along with its instructions located here: Bulk backup script

  • Before executing the bash script, you will need to create an App Password if you do not already have one - this is because the script uses our API to extract a list of the repositories belonging to your workspace. Repositories - Read permissions for the app password are sufficient for the script to run.

  • Once you have an API token, you will then need to ensure that the bash script is executable by giving it the necessary permissions:

    chmod 777 account_repo_backup.sh
  • Once complete, you can then execute the script, replacing <Username>, <AppPassword> and <WorkspaceID> with their respective values:

    ./account_repo_backup.sh <Username> <AppPassword> <WorkspaceID>

    You can find your Atlassian account email address here https://bitbucket.org/account/settings/email/.

If you are encountering issues following this documentation, or have any other related questions - please raise a support ticket or raise a community support ticket for further assistance with the backup procedure.

Updated on September 22, 2025

Still need help?

The Atlassian Community is here for you.