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
- How to Delete a Repository in GitHub with Screenshots?
- Delete Local GitHub Repository
- Information About Deleting a Repository in GitHub
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:
- Tap on your profile picture at the top right corner of the GitHub interface and hit on “Your repositories“.
- On your repository list, choose the GitHub repository that you want to remove.
- On the repository page, press the “Settings” icon in the menu.
- In the repository settings, scroll down until you see the “Danger zone“.
- In the “danger zone”, tap on “Delete this repository“
- 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“.
- Congratulations, you have successfully deleted your GitHub repository!
- How To Delete File on Git | Removing Files from Git Repository using git rm Command
- How To List Git Tags | How to Check List of Tags in Git? | Process to List Local & Remote Tags in Git
- How To Install Git On Debian 10 Buster | Debian Git Repository | Debian Buster Git
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.
2. Given the list of repositories that you own, select the one that you want to delete.
3. When you have navigated to the repository main page, click on “Settings” in the repository menu.
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.
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“.
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”
7. Back to the home page, an information message will appear to notify you that you have successfully deleted the 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 email@example.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:
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.
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!