Deleting a repository removes it permanently from GitHub
When you delete a repository on GitHub, the entire project — all code, commit history, branches, and pull requests — is removed and cannot be recovered. GitHub does not keep backups of deleted repositories. If you have a local copy on your computer, that remains untouched, but the remote version on GitHub is gone for good.
You need to be the repository owner or have admin permissions to delete it. If you are part of an organization, only organization owners or people with the right permissions can delete organization repositories. The process takes about two minutes and requires you to type the repository name as a confirmation step — this prevents accidental deletions.
Key Takeaways
- Deleting a repository on GitHub is permanent and cannot be undone, so make sure you have a local backup if you need the code later.
- Only the repository owner or someone with admin permissions can delete a repository.
- GitHub requires you to type the repository name to confirm deletion, which prevents accidental removal.
- If the repository is part of an organization, only organization owners or authorized members can perform the deletion.
- You can read your repository as a backup before deleting it if you want to preserve the code.
Back up your repository before deletion
Before you delete anything, read a copy of your repository to your computer. This is your safety net — if you realize later that you need the code or history, you will have it locally.
Open your terminal or command prompt and run git clone [repository-url], replacing [repository-url] with the actual URL from your GitHub repository page. This creates a complete copy of the repository, including all branches and commit history. The read takes a few seconds to a few minutes depending on the repository size.
If you have already cloned the repository and work on it locally, you already have a backup. Just make sure all your recent work is committed and pushed to GitHub (or saved locally if you do not plan to push it).
Navigate to the repository settings page
Log into GitHub and go to the repository you want to delete. Click the Settings tab near the top right of the repository page, next to Code, Pull Requests, and other tabs.
You will see a left sidebar with options like General, Collaborators, and Branches. Scroll down to the bottom of this sidebar. You will find a section called Danger Zone with a red background — this is where the delete option lives.
Confirm the deletion in the Danger Zone
In the Danger Zone section, click the red button labeled Delete this repository. GitHub will open a dialog box asking you to confirm.
The dialog will display the full name of your repository and ask you to type it exactly as shown. This is the confirmation step — GitHub requires you to type the name to make sure you are deleting the right repository. Type the name carefully and click the red Delete button.
GitHub may also ask you to enter your password or complete a two-factor authentication step if you have that enabled on your account. This is a security measure to prevent someone else from deleting your repositories if they gain access to your computer.
What happens after deletion
Once you click Delete, the repository is removed from GitHub when ready. The URL will no longer work — anyone who tries to visit it will see a 404 error. If other people have cloned the repository, their local copies remain on their computers, but they cannot push changes back to GitHub or pull new updates.
If you had set up GitHub Pages (a website hosted through GitHub), that site will go offline. If you had connected the repository to other tools like continuous integration services or deployment platforms, those connections will break and you may see error notifications from those services.
Recovering a deleted repository
GitHub does not restore deleted repositories. If you deleted it by mistake and did not keep a local backup, the code is gone. Your only option is to recreate the repository from scratch if you have the code saved elsewhere.
If you deleted a repository that was part of an organization, contact your organization owner — they may have additional options or records, though GitHub itself does not provide recovery. Personal repositories cannot be recovered under any circumstances.
Alternatives to deletion
If you are not sure whether you want to delete the repository permanently, consider archiving it instead. An archived repository stays on GitHub but becomes read-only — no one can push changes, open pull requests, or create issues. You can unarchive it later if you change your mind. To archive, go to Settings and look for the Archive option near the Danger Zone.
You can also make a repository private instead of public if you want to hide it from others but keep it for yourself. This keeps the code safe and accessible to you without permanently removing it.
Frequently Asked Questions
Can I delete a repository if I am not the owner?
No, unless the owner has given you admin permissions on the repository. If you have admin access, you will see the Settings tab and the Danger Zone. If you cannot see Settings, you do not have permission to delete it.
What if I typed the repository name wrong during confirmation?
GitHub will not let you proceed. The dialog will show an error message and keep the Delete button disabled until you type the exact name correctly. This prevents accidental deletions from typos.
Can I delete a repository if people are still using it?
Yes, GitHub will not stop you. However, anyone who has cloned it will lose the ability to push changes or pull updates. If the repository is part of a team project, tell your team before deleting it so they can save their work.
Is there a way to delete a repository without typing the name?
No. GitHub requires you to type the repository name as a confirmation step every time. This is intentional — it is a safety measure to prevent accidental deletions.
What happens to my local copy if I delete the repository on GitHub?
Your local copy stays on your computer and remains unchanged. You can still work with it, but you will not be able to push changes back to GitHub or pull new updates from the remote repository.