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.
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/
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alright. Thank you very much for your time and explanation!
Really appreciate it. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.