Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Bitbucket Backup



I am using a windows environment and self hosted "Server" version of bitbucket

I've read several docs on how to do a bitbucket backup but the "Client" looks dated and im not sure how to proceed with that.

Why does bitbucket not have a native backup option like confluence has ?

Documentation is important but you know what is even more important ?


Suggestions, help, advice, tutorials...

Essentially what Im looking for is to have a nightly backup made like I have with confluence and store it on another server which is a normal procedure when it comes to data.

Again I am on a pure windows environment with a MSSQL as the database and self hosted "Server" version of bitbucket



4 answers

1 accepted

1 vote
Answer accepted

Hi Siavash,

for backup the bitbucket you need to backup two things 

1. data directory 

2. database

 write  batch file to copy your bitbucket data directory to your backup machine every day ,

for database you can write a procedure to backup db every day and copy to backup machine 


Am using Bitbucket Server self host but not using any database,then HOW should i backup and restore????

I suggest taking a look at SCM Backup tool:

We've been using this tool through a Jenkins job to take daily backups of our repositories. It's very convenient and works cross-platform. 

Like # people like this

Hello @Haas, regarding SCM, can you confirm if in fact it doesn’t back up the source files?
In a possible restoration of the data, he will seek the sources from which place?


I'm not sure what you mean by source files. It backs up everything in a given git repository as a bare repository. The restoration is a manual task which is not a function of SCM. You just need to copy the back up to the place you want and then just "git clone bare-repo working-repo". You can see the details in its documentation.

Like Vinicius B. Dezan likes this


I understood, in this case, what I was referring to would be the project's source codes, as these are not saved in the backup file, as described in this part of the documentation:

"Your complete history and your source code are in there - you just don’t see the actual files!

The repository is backed up without a working directory, because it’s not necessary. "

In reality I did not understand very well what it says there, in this case, the source codes are also backed up or when I restore the backup will I have to get the source codes from my local workspace or from my bitbucket repository?

thank you again.

Like Haas likes this

@Vinicius B. Dezan 

I see your confusion. That's the "bare repository" concept. It seems strange at first glance, indeed. However, it's very simple and it actually forms the backbone of the whole git system.

A bare repository is basically what we call a remote repository in practice, in our case Bitbucket. It's used for centralizing the code versioning for the developers who share it, as you know. Because no one ever makes edits directly to files in the shared bare repo, a working tree is not needed. That's why I mentioned in my previous post "working-repo". If you think about it, it makes sense: it's "bare" because it does not have a working tree. ;)

What SCM does is simple: it creates a new bare repo for you and it becomes your backup file for that repository. Therefore, to restore your working repository to your local environment, you just need to clone from the backup file, just like cloning from a remote repo. In the end, after restoration, you'll see the source code files in your local. Depending on the type of restoration, there might be some additional things to do, such as changing the remote repo URL or (re)tracking all the remote branches, etc.

Like Vinicius B. Dezan likes this


Now I understand, so in this case, even though there are several developers working on the project, I can do the restoration from a previous day for example using the backup made by SCM (daily backup with the same) and with that, I will have all the source code with the changes that day, without relying on bitbucket or any local directory, correct?

Thank you very much again for returning.

@Vinicius B. Dezan 

You're welcome and yes, what you said is correct.

Like Vinicius B. Dezan likes this


Before performing a backup should I stop the bitbucket service ?

Reminder this is a windows environment..



No need , but you should scheduled backup at night time when server is not busy  

OK great.

I got some scripts to write...


Thank You

HI @CenturyX476

Why does bitbucket not have a native backup option like confluence has ?

As you will know the bitbucket has the code and for native backup, it will take a lot of time (depends on data) as well as consume memory.

As @ajeet_singh said, you can sync your <Bitbucket_Home> dir to your backup server every interval time (depends on you how to want to sync at every an hour/day) and you can write a bash script using which you can take the database backup.

For running automatically the Bash script you need to add the corn job accordingly.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Bitbucket

⭐ Calling all Bitbucket and DevOps experts: Special showcase opportunity ⭐

Hi, Bitbucket community! Are you a DevOps practitioner (or know one in your network)? Do you have DevOps tips, tricks, or learnings you'd like to share with the community? If so, we'd love to hea...

1,478 views 4 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you