Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Restore repositories in bitbucket

Storm Landew April 9, 2018
My database became corrupted, I don’t have backups to restore it. I’m greeted with failed to start MVC Spring when starting bitbucket.

How can I restore from the repos stored in the home directory?

1 answer

0 votes
Vivian C
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
April 11, 2018

Hi Storm,

Unfortunately, with a corrupted database, your only option here is to copy all the repositories from the Bitbucket Home Directory manually, and then start a fresh new Bitbucket instance with a new database and push everything to the new instance.

Here are the steps you can perform to proceed on in this case:

  1. Locate all the bare repositories from the following directory: Bitbucket_Home/shared/data/repositories
  2. Copy all these repositories manually to a directory on your local machine
  3. Start a fresh new Bitbucket instance with a new database
  4. Push all the repositories you have copied from the old Bitbucket Home Directory to the new Bitbucket instance.

Also, a little hint:

All the Bitbucket repositories are stored in $BITBUCKET_HOME/shared/data/repositories. On the first step, you will see each repository in here will be in a folder named as the repository's database ID. You may find a repository-config file inside each folder, which amongst other things will help you identify the repository by project and repository name. This file should help you to identify which folder belongs to which repo and project, so you can recreate the projects and repos on the new instance based on their names.

Just note that in this case, all the metadata, such as comments, pull requests, permissions and settings will be lost unfortunately due to these are stored in the database.

Hope this helps!

- Vivian

Jason Walkowicz July 25, 2019

what is the push command to perform this from within the old repository directory?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events