Repositories with incomplete or vague intents can hurt your reputation on GitHub. Is your GitHub full of unwanted or sketchy public repositories? Then you might want to delete them to tidy things up.

In this post, we'll guide you on how to do that.

Why You Need to Delete Bad GitHub Repositories

You don't want to present a messy GitHub to potential employers while job hunting. Poor repositories full of practice code or vague unfinished projects don't present a good picture of your abilities.

Furthermore, it can make potential clients doubt your competence.

These problems may not apply to you if you don't use GitHub professionally. But if you plan to get serious with your workflows and present a more professional GitHub, you should clean up your repositories. You can start by removing those that don't add value to your GitHub credentials.

How to Delete a Remote Repository on GitHub

GitHub doesn't offer a command line option for deleting repositories. As a result, you need to delete it manually via the web app.

However, you must be an administrator with permission access before you can delete a GitHub repository.

Related: How to Clean Git and Remove Untracked Files

To delete a GitHub repository, open your browser and log in to your GitHub account. Then use the following steps:

  1. Click the round profile icon at the top-right corner of the web app.
  2. From the dropdown, select Your repositories to load all your repositories.
    Drop down icon for navigating to repositories
  3. Select the repository you wish to delete.
  4. Look to the top of the selected repository menu and click Settings.
    A GitHub repository menu with settings option
  5. Scroll to the bottom of the settings page and you'll see a section named Danger Zone.
  6. To delete the selected repository, click Delete this repository.
    Repository settings menu danger zone
  7. From the pop up box, type your username/repository name in the field provided.
  8. If you're certain you want to delete the repository, click I understand the consequences, delete this repository to remove it from your remote repository on GitHub.
    Repository settings menu delete confirmation modal box

What Happens When You Delete a Remote Repository?

Removing a repository on GitHub is like deleting a file completely from your PC. However, when you delete a remote repository, you should take note of the following:

  • You can't retrieve a deleted repository.
  • Deleting a remote repository doesn't affect the project files locally.
  • It doesn't affect your local repository either.
  • All comments, packages, workflow, and administrators are deleted with it.
  • A deleted repository cannot be forked.

Considering the consequences of deleting a GitHub repository, you might want to change your mind. However, GitHub also lets you archive repositories instead of deleting them.

You can access that option by clicking Archive this repository in the Danger Zone.

How to Delete a Local GitHub Repository

You can also delete a local GitHub repository if you want. All you need to do is delete the .git folder in your project root.

To do that, open the command line and cd into your project root folder. Then type the following command:

        rm -rf .git

While the above command works for Mac and Linux, the process is a bit different on Windows.

Related: Windows CMD Commands You Must Know

To delete a local repository on Windows, open the command line as an administrator. You can do that by typing cmd in the Windows search bar.

Right-click cmd from the search result. From the options, select Run as admistrator.

Once the command line opens, leave the system directories by using <cd..>. Then cd into the root folder of your project and type the following command:

        rmdir .git

However, if the .git folder isn't empty, use:

        rmdir /s .git

Organize Your GitHub Repositories

Your GitHub repository is part of your online credentials. It can serve as a portfolio where potential clients can check your workflows and projects you've either completed or executing.

However, in addition to keeping the vague ones out, giving your repositories definite names helps people know what it's all about at a glance.