How To Delete a GitHub Repository

As a developer once you are done with the software development process, the application should be decommissioned. In such cases, developers may see themselves in a situation where they need to delete a GitHub repository. 

Deletion of a Github Repository is not an easy task as well as not a difficult task for developers if they follow the steps prevailing here. In this tutorial, we have explained how you can easily delete a repository in GitHub. Also, you can discover some more information like warnings about git repository deletion from the below modules.

Steps to Delete a GitHub Repository

Deleting GitHub repositories is pretty straightforward. The process is the same whether you are dealing with public or private repositories. To delete a GitHub repository, just follow the steps outlined here:

  1. Tap on your profile picture at the top right corner of the GitHub interface and hit on “Your repositories“.
  2. On your repository list, choose the GitHub repository that you want to remove.
  3. On the repository page, press the “Settings” icon in the menu.
  4. In the repository settings, scroll down until you see the “Danger zone“.
  5. In the “danger zone”, tap on “Delete this repository
  6. To confirm the GitHub repository deletion, you have to type the repository name. When you are done, just press “I understand the consequences, delete this repository“.
  7. Congratulations, you have successfully deleted your GitHub repository!

How to Delete a Repository in GitHub with Screenshots?

In case you had trouble following the steps described above, here are all the screenshots that will guide you in deleting your GitHub repository.

1. Click on your profile picture and select the “Your repositories” option.

Delete GitHub repository with screenshots repository

2. Given the list of repositories that you own, select the one that you want to delete.

Delete GitHub repository github-repository

3. When you have navigated to the repository main page, click on “Settings” in the repository menu.

Delete GitHub repository settings

4. Now that you clicked on “Settings”, scroll down until you reach the “Danger zone” of your repository.

In this zone, you have the option to delete your GitHub repository, click on it to proceed.

How To Delete a GitHub Repository delete-repository

5. When clicking on “Delete this repository“, you will be asked to provide the repository name in a field in order to confirm that you want to delete this repository.

Type the repository name and click on “I understand the consequences, delete this repository“.

How To Delete a GitHub Repository delete-2

6. In some cases, you are asked to provide your user password in order to confirm the deletion.

Type your user password and click on “Continue”

How To Delete a GitHub Repository confirm

7. Back to the home page, an information message will appear to notify you that you have successfully deleted the Github repository.

How To Delete a GitHub Repository confirmation

Delete Local GitHub Repository

In some cases, you don’t want to delete a remote GitHub repository but you only want to delete the copy you got by cloning the remote repository.

In order to delete a local GitHub repository, use the “rm -rf” on the “.git” file located at the root of your Git repository.

$ rm -rf <repo_folder>/.git

By deleting the “.git” file, you will delete the Github repository but you won’t delete the files that are located in your project folder.

As a consequence, you will be able to initialize a new Git (or Github) repository using “git init”, add a remote using “git remote add” and start committing new files!

$ git init

$ git remote add origin git@github.com:<user>/<repository>.git

$ git push -u origin master

Careful, if you use the “git push” command without the “-u” option (for the upstream branch), you will be asked to provide the upstream branch.

Make sure to read our dedicated tutorial if you want to find more information about upstream branches.

Check More Articles on Git: 

Information About Deleting a Repository in GitHub

You can delete any repository, if you’re the owner of the organization or if you own admin permissions for that repository or fork. A few things to remember, though:

  • Deleting a fork does not have any effect on the upstream repository.
  • Deleting a private repository will delete all associated forks, but deleting a public repository will not have any effect on the forks.
  • Deleting a repository will remove all wikis, issues, and comments associated with the repository. Once deleted, there is no way to restore a repository. So, always keep in mind.

Conclusion

In this tutorial, you have discovered how you can easily delete Github repositories along with the detailed steps to get rid of your Github repository remotely, but also locally by using the “rm” command.

If you are interested in Git, GitHub, and software engineering, we have a complete section dedicated to it on the website like Git Commands, so make sure to check it out!

Leave a Reply

Your email address will not be published.