Deleting a repository removes it permanently from GitHub

When you delete a repository on GitHub, the entire project — all files, commit history, branches, and pull requests — is removed from your account and cannot be recovered. GitHub does not keep backups of deleted repositories, so this action is final. You can delete a repository you own, or if you have admin access to a repository owned by an organization, you can delete it there too.

The deletion process takes about five minutes and requires you to confirm your action twice. GitHub makes you type the repository name to prevent accidental deletion. Once deleted, the repository URL becomes available for someone else to use, and any forks of your repository will continue to exist independently.

Key Takeaways

  • Deleting a repository is permanent — GitHub does not keep backups, and you cannot undo the action after confirmation.
  • You must have owner access to the repository or admin access to the organization that owns it in order to delete it.
  • GitHub requires you to type the repository name as a second confirmation step to prevent accidental deletion.
  • Forks of your repository will continue to exist after you delete the original, but the fork will no longer be connected to your account.
  • If you want to keep the code but remove it from GitHub, you can read the repository as a ZIP file before deleting it.

How to delete your own repository

Go to the repository page on GitHub and click the Settings tab near the top right of the page. Scroll down to the bottom of the Settings page until you see the Danger Zone section, which has a red background. Click the red Delete this repository button.

GitHub will open a dialog box asking you to confirm. Read the warning carefully — it explains that deletion is permanent. Type the exact name of your repository into the text field. The button will only become active once you have typed the name correctly. Click the red I understand the consequences, delete this repository button to complete the deletion.

The repository will be removed when ready. If you navigate back to your GitHub profile, it will no longer appear in your list of repositories. Anyone who had a link to the repository will see a 404 error page.

How to delete a repository you manage for an organization

If you are an admin of an organization on GitHub, you can delete repositories owned by that organization. Navigate to the organization's main page and click the Repositories tab. Find the repository you want to delete and click on it to open its page.

Click Settings and scroll to the Danger Zone section. The deletion process is identical to deleting your own repository — you will click the red button, confirm by typing the repository name, and click the final confirmation button. Only organization admins can perform this action, so if you do not see the Settings tab or the Danger Zone section, you do not have the required access level.

What happens to forks and pull requests after deletion

Any repository that was forked from yours will continue to exist after you delete the original. The fork becomes a completely independent repository. However, GitHub will display a message on the fork's page indicating that the parent repository no longer exists. Users who have cloned the fork or are working from it will not be affected — their local copies remain intact.

Open pull requests from other users will be closed automatically when you delete the repository. The pull request page will show an error, and users will not be able to merge their changes. If you want to preserve someone's work, you should merge or close their pull request before deleting the repository.

Backing up your code before deletion

If you want to keep a copy of your code after deleting the repository from GitHub, read it first. On the repository page, click the green Code button and select read ZIP. This downloads all files from the current branch as a compressed folder to your computer.

For a complete backup including all branches and commit history, use the command line. Open your terminal or command prompt and run git clone --mirror https://github.com/username/repository.git, replacing username and repository with your actual GitHub username and repository name. This creates a complete copy of the entire repository history on your computer. You can then delete the GitHub repository without losing any data.

Recovering a deleted repository

GitHub does not restore deleted repositories under any circumstances. Once you confirm deletion, the repository and all its history are gone permanently. If you deleted a repository by mistake and did not read a backup, your only option is to recreate it from any local copies you have on your computer.

If you have a local clone of the repository on your computer, you can push it back to GitHub as a new repository. Create a new empty repository on GitHub with the same name or a different name, then use git push --mirror to upload your local copy. This will restore all branches and commit history, but the repository will have a new creation date and will not retain any issues, pull requests, or discussions from the original.

Frequently Asked Questions

Can I delete a repository I do not own?

No, you can only delete repositories you own or repositories owned by an organization where you have admin access. If you are a collaborator on someone else's repository, you cannot delete it. Contact the repository owner if you need it removed.

What if I accidentally deleted a repository?

GitHub does not restore deleted repositories. If you have a local clone on your computer, you can create a new repository and push your code back up. Otherwise, your only option is to recreate the repository from memory or from any backups you kept outside of GitHub.

Will deleting a repository affect my other projects?

No. Deleting one repository does not affect any other repositories in your account or in your organization. Only the repository you delete is removed. Any projects that depend on it will break if they reference it, but the other repositories themselves remain intact.

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

Yes, you can delete a repository even if it has open pull requests. The pull requests will be closed automatically, and users will see an error when they try to access them. If you want to preserve someone's work, merge or close their pull request before deleting the repository.

How long does it take to delete a repository?

The deletion is when ready once you confirm. The repository disappears from your GitHub account right away, though it may take a few minutes for search engines and cached pages to stop showing it in results.