Deleting a repository is permanent and removes all code, history, and branches

When you delete a GitHub repository, the entire project vanishes — all code files, commit history, branches, pull requests, and issues. GitHub does not keep a backup you can recover from later. If you own the repository, you can delete it yourself in about two minutes. If someone else owns it, you cannot delete it, but you can remove yourself from it. Before you delete, make sure no one else on your team needs the code or its history.

The deletion is when ready. There is no undo button and no waiting period. If you think you might need the code later, read it first or create a backup branch in another location.

Key Takeaways

  • Deleting a repository removes all files, history, and branches permanently with no recovery option.
  • Only the repository owner can delete it; collaborators cannot delete a repository they do not own.
  • You can read your repository as a ZIP file or clone it to your computer before deleting if you want to keep the code.
  • If you no longer want to see a repository you do not own, you can unwatch it or leave the organization instead of asking for deletion.

How to delete a repository you own

Go to the repository page on GitHub.com. 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 with a red background.

In the Danger Zone, click the red Delete this repository button. GitHub will ask you to type the repository name exactly as it appears to confirm you really want to delete it. Type the name and click the red I understand the consequences, delete this repository button. The repository is now gone.

This process works the same way whether the repository is public or private, and whether it has one file or thousands. GitHub does not ask you to wait or send a confirmation email — the deletion happens when ready after you confirm.

What to do if you want to keep the code but not the repository

If you want to remove the repository from GitHub but keep the code on your computer, clone it first. Open your terminal or command prompt and run git clone https://github.com/yourusername/repositoryname.git, replacing the URL with your actual repository URL. This creates a folder with all the files and the full commit history.

You can also read the repository as a ZIP file without using Git. Go to the repository page, click the green Code button, and select read ZIP. This gives you all the current files but not the commit history. The ZIP option is faster if you only need the latest version of the code.

After you have downloaded or cloned the repository, you can safely delete it from GitHub. The copy on your computer will remain untouched.

If you are a collaborator but do not own the repository

You cannot delete a repository you do not own, even if you have write access. Only the person or organization that created the repository can delete it. If you want to stop working on it, you can remove yourself by leaving the repository or the organization.

To stop seeing a repository in your feed, click the Unwatch button on the repository page. To remove yourself from an organization, go to the organization settings and look for the option to leave. If you think the repository should be deleted, contact the owner and explain why.

What happens to forks and pull requests when you delete

If other people have forked your repository, their copies remain on GitHub even after you delete the original. A fork is an independent copy, so deleting the original does not affect it. However, the fork will no longer be able to sync with the original repository or create pull requests back to it.

Any open pull requests from your repository to other projects will be closed automatically. If someone has an open pull request to your repository from their fork, that pull request will also close. The commits themselves stay in their repository, but the link between the repositories breaks.

Reasons to delete a repository

You might delete a repository because the project is finished and you do not need to maintain it anymore. You might delete a test repository you created to learn Git. You might delete a repository because it contains sensitive information that should not be on GitHub, though in that case you should also check your commit history to make sure no passwords or API keys are stored there.

If a repository contains sensitive data, deleting it from GitHub is not enough — the information may still exist in your local Git history or in anyone else's clone. For truly sensitive material, consider using a tool like git-filter-branch or BFG Repo-Cleaner to remove it from the entire history before deleting the repository.

Frequently Asked Questions

Can I recover a deleted repository?

No. GitHub does not keep backups of deleted repositories. Once you confirm the deletion, the repository and all its history are gone permanently. If you think you might need the code later, read it or clone it to your computer before deleting.

What if I delete a repository by accident?

Contact GitHub Support as soon as possible. They may be able to recover it if you reach out within a short time window, though recovery is not may provide. The faster you contact them, the better your chances.

Do I need to delete branches before deleting the repository?

No. When you delete the repository, all branches, pull requests, and issues are deleted with it. You do not need to clean them up first.

If I delete my repository, will it affect my collaborators' work?

Their local copies on their computers will still exist, but they will no longer be able to push changes to GitHub or pull updates from the original repository. They should clone or read their work before you delete if they need to keep working on it.

Can I delete a repository owned by an organization?

Only if you have owner permissions for that organization. Go to the repository Settings, find the Danger Zone, and follow the same deletion steps. If you do not have owner permissions, ask someone who does.