How To Delete Repository In GitHub

Developing and executing plenty of projects which are made using the GitHub account consumes many repositories. This blog showcases how to delete repository on GitHub. Here, we are going to discuss certain things that are required to check before delete repository GitHub is performed, warnings that incur for GitHub delete repository, and then will proceed to implement the steps for the GitHub repository delete. GitHub is a very popular platform used by many users to exhibit their projects online, and creating new repositories for side projects is an added advantage. Being found that you are having too many repositories flooded in your account and would like to simplify your profile, then this blog guides you to learn how to delete a repository in GitHub.

Checklist for Verifying the Repository Deletion

Before deleting a repository make sure to run through the following checklist:

  1. Teamwork: The repository is not necessary anymore to maintain but in case while working in a team, make sure that the team associates are also not required anymore!
  2. Permissions: Verify that you have sufficient permissions to delete the repository? You should be either an organization owner or have admin permissions for the repository.
  3. Sure: Finally, double-check that you have the right repository and that you really want to remove it. Once it is deleted, it's deleted!

Warnings Concerning Deleting a Repository in GitHub

If you are the organization owner then you can have the right to delete any repository or fork. The repository can be deleted even when you have admin permissions for it. If Allow members to delete or transfer repositories for this organization has been disabled, only organization owners can delete organization repositories. Keep the following instructions in mind while deleting a repository.

  • 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. 

You are able to restore some deleted repositories within 90 days. To find more information on how to do this, see "Restoring a deleted repository."

Git Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning

How to Delete a Repository in GitHub?

To start the deletion process, open GitHub, and log in to your account and then proceed with the following steps.

  • On GitHub, navigate to the main page of the repository.
  • Under your repository name, click the “cog” icon for Settings.

IMAGE

  • Under Danger Zone, click on the “Delete this repository” button.

IMAGE

  • Read the warnings.
  • To verify that you're deleting the correct repository, type the name of the repository you want to delete.

IMAGE

  • Click I understand the consequences, delete this repository.
Ops Trainerz

Subscribe to our youtube channel to get new updates..!

Delete Local GitHub Repository

In a few cases, you may not need to delete a remote GitHub repository but you only would like to delete the copy you got by cloning the remote repository. In order to delete a local GitHub repository, use the command “rm -rf” on the “.git” file located at the root of your Git repository.


$ rm -rf /.git


By deleting the “.git” file, you will delete the Github repository but you wouldn’t be able to delete the files that are located in your project folder. As a result, you would be able to initialize a new 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:/.git

$ git push -u origin master


Apply the “git push” command without specifying the “-u” option that denotes the upstream branch, in which you will be asked to provide the upstream branch.

Git Training

Weekday / Weekend Batches

Conclusion:
Thus we have now reached the end of this blog, you have learned how to delete the repository in very simple steps. You have seen the detailed steps to get rid of your Github repository remotely, but also locally by using the “rm” command.

Krishna
Krishna
AWS Lambda Developer
I am working as AWS Lambda Developer since 2014. and I have good knowledge skills on AWS & DevOps Platform. TO share my Knowledge through Blogs from OpsTrainerz is Good Opportunity to Me.

Request for more information