Restoring a Deleted Repository in GitHub and Bitbucket
Each of us certainly experienced a situation where we first got rid of some data, because we did not need it, but after some time we realized that we wanted to recover this data. It could be anything, an old note, a photo, or it can be an entire repository. Then what? We would like to recover this data somehow! Unfortunately, this is not always possible, so we should remember to regularly back up our data. Today, we will talk about repositories and how we can recover them using two popular services – GitHub and Bitbucket.
Let’s delete GitHub repository
Before we figure out how to restore a repository, let’s first delete it. If you want to know more about removal, you should check out the article here: How to delete a repository in GitHub But for now we don’t need to know the details. Let me show you a simple scenario in GitHub.
To remove a GitHub repository you need to open the settings of that one and scroll down. There you will find the section called “Danger Zone” which contains a few options. One of them is “Delete this repository”. So let’s do that and remove it.

Now, let’s do the same with Bitbucket and then jump to the restoring topic. The story is similar. You need to open the repo, that you want to remove, move to the “Repository settings” section and then in the upper right corner click on the button “Manage repository”. It is a select field with two options: “Transfer repository” or “Delete repository”. Select the second one and then you will see this:

All right, we’ve done it. But be aware of the consequences. Deleting the repository is a permanent action and will remove all of its settings, comments, and so on. So, be careful with this operation!
Visual learner? Then, don’t read but watch our GitProtect Academy video to find out how to restore a deleted repository in GitHub and Bitbucket (Psst, don’t forget to subscribe!)
How to restore a deleted repository
What does “restore” actually mean? We’ve already established that deletion is permanent, so you might ask yourself – “What’s this all about? How can I recover something that is permanently deleted?”. Well, the answer is not that simple and it depends on what hosting service we use. For sure we will lose all information not directly related to our files, such as permissions, comments, labels etc. Let’s check how it works thoroughly.
GitHub allows us to recover the repository within 90 days of its deletion. But there are a few things we need to know about this, especially if our repository was part of the fork network. What is that? The official documentation will explain to us:
A fork network consists of a parent repository, the repository’s forks, and forks of the repository’s forks.
Complicated? It may sound like that, but it is not. Now the important thing, which is why this definition is important. If our repo was part of such a network then it cannot be restored! Well, unless every other repository in the network would be deleted or detached, but that scenario is highly improbable and often it’s not up to us.
In the documentation, we can find a mention that if we want to restore such a repository, if we cannot do it ourselves, we can contact GitHub Support on this matter, so let’s not lose hope. However, keep in mind this is only available on a paid plan and I do not recommend this type of solution because this way we lose control. And you cannot be 100% sure that the support could help you resolve the problem. Being dependent on others to fix issues is never a good thing when it comes to accessing our data.
Okay, but let’s move on to the most important one, which is the answer to the question that led us here. To restore the deleted GitHub repository, we need to open the settings, go to the “Repositories” tab, then we will see something like this:

All of our deleted repositories will be listed under the “Deleted repositories” tab. Of course, all that were deleted no more than 90 days ago. Note the message on the blue background, GitHub informs us directly that the repositories belonging to fork network cannot be restored as I described above. Another important thing is the information about the time interval between deletion and restoration. You can test yourself, create a new repository, delete it, and then go straight to restoring. Spoiler alert – you will fail. But that shouldn’t be a problem, because if you want to restore the deleted repository, most likely it was removed much earlier than an hour ago.
How secure are your repos and metadata? Don’t push luck – secure your code with the first professional GitHub, Bitbucket, and GitLab backup.
Recovering deleted repository in Bitbucket
Bitbucket does not offer the same self-service repository restore flow as GitHub. In Bitbucket Cloud, Atlassian Support can help recover core repository content only if the deletion happened within the last 7 days. However, metadata cannot be recovered, and content deleted more than 7 days ago is no longer restorable from Atlassian’s side. If you have a local copy of the repository, you can also recreate the repository manually by creating a new empty repository in Bitbucket Cloud and pushing the local copy back to it.
For Bitbucket Data Center, Atlassian’s documented process restores Git history only and does not restore repository details, permissions, settings, hooks, or pull requests. This is why third-party Bitbucket backup remains important if you need more predictable and complete recovery.
Conclusions – restoring a deleted repository is not easy
First of all, everything depends on the platform we use, but even the very friendly GitHub has some limitations related to it. Having our own backups and our own recovery procedures gives us peace of mind because we can keep them for as long as we want and restore them from any point in time to many destinations (the same or new repository, account, cross-over to another git hosting service or to your local machine). They also allow us to simplify the recovery procedures, which will certainly make our work easier. Although remember we can always run into some problems if our procedures are not up to date. So think over your decision a few times before you decide to delete the repository. Or at least have DevOps backup in place then.





