Organizing things is as important as real work. It helps you to manage things easily.
Suppose you are working on a project and created some folders and files to work. And later decided that they are not necessary for the current project. But you didn’t remove them for some reason.
What happens shortly?
Nothing. It just becomes a big mess for you.
So, the importance of organizing should be one of ours top skills. Here, we will make sure our GitHub account is clean by deleting the unused repositories from our accounts.
There might be different approaches to do a task. But, here, we have only one way to delete the GitHub repository. We are going to see it in detail.
Let’s get started without further ado.
Deleting a Repository
Don’t get confused. GitHub web app is nothing but the website. Technically, it’s a web application, not a website. But, most of us get used to the word website—a new technical thing for those who don’t know about it.
Anyway, let’s go to our main topic of deleting a repository in GitHub.
- Go to the GitHub.
- Log in to your account.
- Search for the repository that you want to delete from your account.
- Click the repository from the result and open it.
- Click on the Settings button from the top navbar.
- It’ll navigate you to the settings page of the current repository.
- Scroll down to the end of the settings, where you’ll find a section called Danger Zone.
- There is an option called Delete this repository at the end. And that’s the only option we are interested in right now.
- Click on the button Delete this repository.
- GitHub asks us to make sure about deleting the repository with a warning message (read it). And also asks us to confirm it by typing the repository path.
- Enter the repository path in the input box as shown. We can copy the repository path that’s shown in the warning message to speed up the process.
- Click the button. I understand the consequences, delete this repository to delete the repository.
- It’ll redirect us to the GitHub home page after deletion and shows a success message as follows.
Finally, we have deleted the GitHub repository.
Is there any other way to delete GitHub repository?
Unfortunately, not that I am aware of. There’s no other way to delete a GitHub repository as of now.
Restoring a Repository
What if you deleted a repository by mistake? Is there a chance to get it back?
Yeah, we can restore the repository with some exceptions. Let’s see how to restore our deleted GitHub repository.
There are two instances where we can’t restore the repository.
- The number of days deleted repository exceeds 90 days.
- If the repository is part of the fork network until all other repositories are deleted.
Let’s see the steps to restore a repository.
- Go to settings in your GitHub account.
- Click on the Repositories button from the left navbar.
- You will navigate to the repositories page as follows.
- Click on the Deleted repositories button from the Repositories section.
- You will see all your deleted repositories as follows.
- Read the info message in the above pic. As they mention, it may take an hour to show our deleted repositories in the section.
- Once your repository is shown in the Deleted repositories section, you can restore it.
- You will find a Restore button at the end of the repository item, as shown below.
- Click the restore button.
- GitHub will show us a modal with a message what will be restored.
- Read the message.
- Click on the I understand, restore this repository for confirmation.
- It’ll show Done! message as follows.
Go to the home page and search for the repository. There you go, you will find the restored repository.
Make sure you are deleting the repository that’s not useful for you. And make use of the restoration option in case you deleted a repository by mistake.
And we can back up a repository in cloud storage. Storing the repository zip in cloud storage like Google Drive, Dropbox, etc.., might help us in the future. If there is a situation where deleting a repository is uncertain, then you can back up the repository in any cloud storage platform and delete it.
Back up will be useful when you are deleting a complex project. Creating complex or big projects from scratch will take a lot of time. You may back up the complex repositories before deleting them.
Next, find out how you can set up passwordless authentication to GitHub’s private repo.