Bitbucket backup all repositories – Bitbucket Backup Script

21. July 2014 Scripts 11
Bitbucket backup all repositories – Bitbucket Backup Script


Bitbucket Backup All Repositories

  • How to Backup my entire bitbucket accounts to a local system.
  • Backup should be easily restorable to any git provider.
  • Restore should contain the branches, tags and commit history.
  • Bitbucket backup script


    • Please go the GitHub Repositoryย and Click Download as ZIP.
    • Read the repo information ย (readme) file for details on the setup.
    • Run it from any Local / Dedicated server connected to the internet and you are ready to go.
  • You can set it as a cronjob to execute on a daily basis. Note: Please note that this script is in Alpha stage. But still it will do the job.

What Now

  • You can simply create a backup retention with shell script or with your backup device. – You can use s3cmd command on the server to upload it to s3 of AWS
  • Upload to Dropbox with Dropbtobox CLI script

Restoring the Backup

11 thoughts on “Bitbucket backup all repositories – Bitbucket Backup Script”

  • 1
    Emepe on March 30, 2016 Reply

    Works perfect, thank you.

    • 2
      Jobin Joseph on May 2, 2016 Reply

      @edepe:disqus Thanks for trying this. ๐Ÿ™‚

  • 3
    Wojciech Programista on April 13, 2016 Reply

    Works for me. Thanks man!

  • 6
    Ruslan on March 30, 2018 Reply

    How should I modify script for using HTTPS instead SSH?

    • 7
      Jobin Joseph on March 30, 2018 Reply

      Hi Ruslan, it is recommended to use ssh, you just need to add the ssh key to your account.
      If you want, you can modify the bare clone section.

  • 8
    Yogesh on August 29, 2018 Reply

    Hi Jobin,

    First of all thanks for this.
    I have some questions like..
    1. Is that I need to provide the bitbucket server URL as a username?
    2. Could you please show me how to configure the cron job for this so that it should take the backup of bitbucket server every night @3 AM.

    • 9
      Jobin Joseph on August 29, 2018 Reply

      Hi Yogesh,
      1. The username is not the url, it is the username / handle of the account.
      2. You can just google it, unfortunately i dont have a post on that.

      • 10
        Yogesh on August 29, 2018 Reply

        Thanks for quick response.

        I have the below cron job ..where should i need to configure this..
        0 14 * * 1-5 (At 14:00 on every day-of-week from Monday through Friday)
        as our bitbucket server was installed on Ubuntu.

        • 11
          Jobin Joseph on August 29, 2018 Reply

          Hi Yogesh,

          The script is made for backing up the online SaaS model . May be you can modify the server API URL in the script to backup repository from your own server.

Leave a Reply to Wojciech Programista Cancel reply

Your email address will not be published. Required fields are marked *