Missed Team ’24? Catch up on announcements here.

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

How do files get stored?

G4nja Wizard December 9, 2019

We have a bitbucket server and wondered, on how to recover a single file, If someone accidently deletes a file? We found where a repository gets stored, but our test textfile is nowhere. Is it possible that this will be stored in the database? We have no LFS mounted.

1 answer

1 accepted

0 votes
Answer accepted
Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 9, 2019

Hi @G4nja Wizard,

Welcome to Atlassian Community.

Repositories in Bitbucket are just regular Git repositories and are not stored in the database. A Git repository has the full history in it, so if you just used the regular delete and committed that change, you can always go back to a previous commit to retrieve the file. Have a look at this blog post on how to restore a deleted file, https://hibbard.eu/how-to-restore-a-previously-deleted-file-from-a-git-repository/

G4nja Wizard December 9, 2019

Hi and thx for the reply!

This will only restore Files, right? A repo can't be restored unless ur server has no backup plan?

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 10, 2019

Correct, it will only restore a file that is part of the repository. Git is a distributed version control system, meaning that all copies of a repository have the full history in it. So if you by accident delete a file and then commit that change, you can always restore the file from the history. 

The only thing stored in the database connected to Bitbucket is additional information about your repositories, for example, permissions, pull requests, etc. Things that do not come directly from Git.

G4nja Wizard December 10, 2019

Well tank you!

That means, that if my repository gets removed by accident, and I recover only the repo directory, the database will have no more information about it.

I am asking, because we have a general Server Backup for all Machines, but it won't restore the database information. To make the repo work again after recovery, I have to restore the information in the database manually?
For this case I got to use for example this:

https://confluence.atlassian.com/bitbucketserver/using-bitbucket-server-diy-backup-776640056.html

?

Mikael Sandberg
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 11, 2019

In order for Bitbucket to work, you have to restore the database together with Bitbucket home directory and the managed repositories. How you do that depends on your backup strategy and database server.

If your repository gets removed by accident, you would have to restore it from backup because Bitbucket adds some additional information to them and it is stored as a bare copy of the full Git repository. A bare repo does not contain a working directory and the revision history is stored differently. 

G4nja Wizard December 13, 2019

Alright. Thank you very much for your time and explanation!

Really appreciate it. :)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events