Code

How to delete a repository from GitHub: via the website, console, and desktop app

How to delete a repository from GitHub: via the website, console, and desktop app

Free Python Course ➞ Mini-course for beginners and experienced Coders. 4 cool projects for your portfolio, live communication with the speaker. Click and find out what you can learn in the course.

Learn More

You often need to clean up your GitHub profile by deleting unnecessary or accidentally created repositories. However, this process can seem complicated due to the peculiarities of the GitHub interface. In this article, we will look at three main methods for deleting repositories: through the web interface, using the command line, and using the GitHub desktop application. These methods will help you effectively manage your profile and keep your projects in order.

Deleting a Repository via the GitHub Website

Deleting GitHub repositories is an important step that should be performed with caution. The most effective way to delete a repository is through your user profile. To do this, log in to the GitHub website, go to your account settings, and select "Delete." You'll then be asked to confirm your intention to delete the repository. Let's go over this process in more detail to avoid potential errors and data loss.

To get started, log in to your GitHub profile and find the repository you want. The left panel displays all your created projects.

We will delete the repository — To_DeleteScreenshot: Skillbox Media

If you have a large number of repositories and you cannot find the one you need on the first page, click the button «Show more» or go to the «Your repositories» tab. This will allow you to view all your repositories and make it easier to find the project you need.

Here you can see a full list of your projectsScreenshot: Skillbox Media

Now open the tab «Settings», which is located to the right of the «Analytics» tab.

Go to repository settings Screenshot: Skillbox Media

Go to your repository settings and scroll down to the "Danger Zone" section. This section really requires caution, as it's possible to accidentally delete all your data or transfer ownership of the repository to another user. Note the last button—"Delete this repository." Use it with caution to avoid losing important information.

Click the bottom button and don't be afraid until nothing is deleted. Screenshot: Skillbox Media

After clicking the "Delete this repository" button, A confirmation dialog box will open. This dialog box will ask you to confirm that you really want to delete the repository. Make sure you understand the consequences of deleting it, as it will be impossible to restore the repository after deleting it. Confirming deletion is important to prevent accidental actions and data loss.

If you understand the consequences, then, of course, we agree with everything. Screenshot: Skillbox Media

To delete a repository, you must specify its full name, consisting of the name Your account and project name. In this example, it would be DavisWalkers/To_Delete. Enter it completely for successful deletion.

Entered the confirmation line - there is no way back. Screenshot: Skillbox Media

Now a button is available to permanently delete the repository - «I understand the consequences, delete this repository. After clicking this button, the project will be completely removed from your profile. When you click the button, you'll be redirected back to your profile, and a notification will soon appear informing you that the repository has been successfully deleted. Make sure you really want to delete the repository, as this action is irreversible.

Deleted — success Screenshot: Skillbox Media

Deleting a repository via the terminal

Command GitHub developers have concluded that deleting projects remotely via the terminal and third-party applications poses a security risk. Therefore, they have restricted such actions. Deleting a repository is possible, but this will only affect the local copy on your device, while the original will remain available on the GitHub platform.

To delete a project from your computer's memory, open a console and navigate to the repository directory using the cd command. Then, delete the .git subfolder using the rm -rf command in the Git console. This will completely delete all repository data, including the revision history. Be careful, as this will be impossible to recover.

The repository is now completely removed from your device. Let's look at how to perform the same operation in GitHub Desktop.

Deleting a Repository via GitHub Desktop

To delete a repository using the official desktop app, navigate to the desired repository, then right-click on the Current Repository tab and select Remove. This process allows you to quickly and efficiently clean up the list of repositories in the application, freeing up space and simplifying navigation.

Deleting a repositoryScreenshot: Skillbox Media

Before deleting a repository, we You'll be prompted to confirm this action. You'll also be asked to move the repository to the trash. Make sure you have checked the appropriate checkbox and click the Delete button.

Confirm deletionScreenshot: Skillbox Media

The repository has been successfully deleted. hard drive.

How to Restore a Deleted Repository

If you want to restore a deleted repository on GitHub, you have the option to do so under certain conditions. GitHub provides clear instructions on how to restore a deleted repository. However, please note that restoration is only possible if the repository was deleted recently and not a significant amount of time has passed since its deletion. Make sure you have access to the account from which the repository was deleted and follow the platform's recommendations for successful recovery.

  • the data was deleted no more than 90 days ago;
  • the deleted project was a branch of another repository that is not currently empty;
  • did you realize you made a mistake when deleting the repository?

The second point is the most important. It can be reformulated as follows: your repository must have a parent repository. Otherwise, data recovery will be impossible.

First, go to the settings section.

Profile settingsScreenshot: Skillbox Media

Select the tab on the left «Repositories» and go to it.

Go to the repositoriesScreenshot: Skillbox Media

Two tabs will be available on the page: «Repositories» and "Deleted repositories". Now let's move on to the second tab: "Deleted repositories".

We look at all the deleted repositories that can still be restored. Screenshot: Skillbox Media

In our case, the requirements were not met, which makes it impossible to restore the repository.

PichalkaScreenshot: Skillbox Media

If everything is OK, you will be able to see a list of recently deleted repositories.

Screenshot: Skillbox Media

Click the "Restore" button, after which the following window appears:

Not sadScreenshot: Skillbox Media

To restore the repository, you need to click the «I understand» button and then select «restore this repository». After this, the recovery process will be complete.

Conclusions

  • You can only delete a repository through the GitHub website. Locally, you can only delete a copy of the repository on your device.
  • To delete a repository, you will need to confirm the operation. And be sure to think twice - maybe you shouldn't delete it after all.
  • Not every repository can be restored - only those that have a non-empty parent repository and that were deleted in the last 90 days.

Reading is an important aspect of our lives. It contributes to the development of thinking, broadening our horizons and improving communication skills. Books, articles and other literature help us deepen our knowledge in various fields and understand the world around us. Pay attention to high-quality sources of information that will help you in self-development. It is important to choose materials that match your interests and goals in order to make the most of your reading time. Don't forget that regular reading helps improve concentration and memory.

  • Instructions: Uploading a project to GitHub without the command line
  • Test. Curse like Linus Torvalds
  • What is GitHub and how to use it