Deleting a GitHub repository removes it permanently

When you delete a repository on GitHub, the entire project — all code, commit history, issues, and pull requests — is removed and cannot be recovered. GitHub does not keep backups of deleted repositories. If you have pushed your code elsewhere (another Git hosting service, a local backup, or a colleague's machine), you can recreate the repository from that copy. If this repository exists only on GitHub, deletion is final.

The deletion process takes about 30 seconds and requires you to be logged in as the repository owner or as someone with admin access to the repository. GitHub will ask you to type the repository name to confirm you understand what you are doing.

Key Takeaways

  • Deleting a repository on GitHub is permanent — the code and all history cannot be recovered once it is gone.
  • Only the repository owner or someone with admin permissions can delete a repository.
  • GitHub requires you to type the repository name as confirmation before deletion proceeds.
  • If you want to keep the code but stop using GitHub, you can export your repository as a backup before deleting it.
  • If you are unsure whether to delete, you can make the repository private or archive it instead to preserve the code.

Steps to delete your repository

Log into GitHub and navigate to the repository you want to delete. Click the Settings tab near the top right of the repository page, just to the right of the Pull Requests tab.

Scroll down to the bottom of the Settings page. You will see a section labeled Danger Zone with a red background. Click the red button that says Delete this repository.

A dialog box will appear asking you to confirm. GitHub will show you the full name of the repository in the format username/repository-name. Type this exact name into the text field. GitHub is strict about this — if you type it wrong or leave it blank, the delete button will remain disabled and you cannot proceed.

Once you have typed the repository name correctly, the red I understand the consequences, delete this repository button will become active. Click it. The repository will be deleted immediately.

Before you delete: make a backup

If there is any chance you might need this code later, create a backup first. The simplest way is to clone the repository to your computer using the command git clone [repository-url]. This downloads the entire project history to your machine. Even after you delete the repository on GitHub, you will have a complete copy locally.

You can also export the repository as a file. On the repository Settings page, look for the Export repository option (this appears on some repositories but not all, depending on your GitHub plan). If available, this creates a downloadable archive of the repository data.

If you have collaborators who might need the code, make sure they have cloned it or have their own backup before you proceed with deletion. Once the repository is gone, there is no way to recover it from GitHub.

When to archive instead of delete

If you want to preserve the repository but signal that it is no longer active, archiving is often a better choice than deletion. An archived repository remains visible on GitHub, people can still view the code and history, but no one can push changes or open new issues.

To archive a repository, go to Settings and scroll to the Danger Zone. Click Archive this repository instead of the delete button. The repository will be marked as archived, and you can unarchive it later if you change your mind. Archiving is reversible; deletion is not.

You can also make a repository private instead of deleting it. This hides it from public view but keeps it on your GitHub account. Private repositories are useful if you want to keep the code for reference but do not want others to see it.

What happens after deletion

The repository URL will no longer work. Anyone who tries to visit the old GitHub link will see a 404 error. If you had shared the repository link with others, those links will be broken.

If the repository was forked by other users, their forks will remain on their accounts. Deleting the original repository does not delete the forks. However, the forks will no longer be able to sync with or pull from the original.

If you had set up GitHub Pages (a website hosted from the repository), that site will go offline. Any custom domain pointing to it will stop working.

If you do not have permission to delete

If you are not the repository owner, you will not see the delete button in the Danger Zone. Only the owner or someone with admin access can delete a repository. If you need the repository deleted, contact the owner and ask them to do it, or ask them to grant you admin permissions first.

If you are a collaborator and want to stop working on a project, you can remove yourself from the repository without deleting it. Go to Settings, click Collaborators, and click the X next to your name to remove yourself.

Frequently Asked Questions

Can I recover a deleted repository?

No. GitHub does not keep backups of deleted repositories. Once you delete it, the code is gone from GitHub permanently. If you have a local clone or backup elsewhere, you can recreate the repository from that copy, but GitHub itself cannot restore it.

What if I delete a repository by accident?

Contact GitHub Support immediately through your account settings. While they cannot restore the repository, they may be able to help if you reach out within a short window. However, do not rely on this — treat deletion as permanent and always back up important code first.

Will deleting my repository affect forks that other people made?

No. Forks that exist on other accounts will remain. They will not be deleted, but they will lose the connection to the original repository and will not be able to sync or pull updates from it anymore.

Can I delete a repository if it has open pull requests or issues?

Yes. GitHub will not stop you from deleting a repository with open pull requests or issues. All of that data will be deleted along with the repository. If you need to preserve that information, export or screenshot it before deleting.

Is there a way to delete a repository without typing the name as confirmation?

No. GitHub requires you to type the full repository name to confirm deletion. This is a safety measure to prevent accidental deletions. You must complete this step to proceed.