Deleting a repo is permanent and removes all code, history, and branches
When you delete a repository on GitHub, the entire project disappears — all your code, commit history, branches, and pull requests are gone. GitHub does not keep a backup you can recover from later. If you are certain you no longer need the repo, the deletion itself takes about 30 seconds. If you might need the code again, read it first or keep a local copy on your computer.
The process is the same whether you own the repo or have admin access to a team repo. You navigate to the repo's settings page, scroll to the danger zone, and confirm the deletion by typing the repo name. GitHub requires this confirmation step specifically to prevent accidental deletions.
Key Takeaways
- Deleting a repo is permanent — GitHub does not keep backups, and you cannot undo the action after confirmation.
- You need admin access to the repository to delete it; regular contributors cannot delete a repo they do not own.
- Before deleting, read your code or clone the repo to your computer if you might need it later.
- The deletion requires you to type the exact repo name as a confirmation step to prevent accidental removal.
- If you only want to stop working on a repo without losing the code, you can archive it instead of deleting it.
Step-by-step deletion on GitHub
Open the repository on GitHub and click the Settings tab near the top right of the page. Scroll all the way to the bottom until you see a red section labeled Danger Zone. Click the red button that says Delete this repository.
A popup window will appear asking you to confirm. It will show your username, a forward slash, and the repo name — for example, yourname/my-project. Type this exact text into the text field. GitHub will not let you proceed until the text matches perfectly. Once you have typed it correctly, the I understand the consequences, delete this repository button will turn from gray to red and become clickable. Click it.
The repo will be deleted when ready. You will be redirected to your GitHub profile page. The repo no longer exists on GitHub, and neither you nor anyone else can access it.
Backing up your code before deletion
If there is any chance you might need the code later, clone the repository to your computer before you delete it. Open your terminal or command prompt and run git clone https://github.com/yourname/repo-name.git, replacing yourname and repo-name with the actual values. This creates a folder on your computer containing the entire project history.
You can also read a snapshot without using Git. On the repo's main page, click the green Code button and select read ZIP. This gives you all the current files but not the full commit history. If you want to preserve the history — which is useful if you ever need to see what changed and when — use the clone method instead.
Who can delete a repository
Only people with admin access to the repository can delete it. If you created the repo, you have admin access automatically. If someone else created it and added you as a contributor, you cannot delete it unless they promote you to admin first.
On a team or organization repo, the owner or someone with owner-level permissions can delete it. If you have push access but not admin access, you will not see the Settings tab or the Danger Zone section — the button straightforward will not appear.
Archiving instead of deleting
If you want to preserve the code but signal that you are no longer maintaining the project, archive the repo instead of deleting it. An archived repo stays on GitHub and remains readable, but you cannot push new code to it or open new pull requests. Other people can still clone it and use the code.
To archive a repo, go to Settings, scroll to the Danger Zone, and click Archive this repository instead of the delete button. You can unarchive it later if you decide to work on it again. This is a good choice if the project is complete, stable, or no longer actively developed but might be useful as reference or for others to fork.
What happens to forks and pull requests
If other people have forked your repo, their copies remain on their accounts even after you delete the original. They can continue to use and modify their forks. However, if they try to create a pull request back to your original repo, it will fail because the repo no longer exists.
Any open pull requests in your repo will be closed automatically when you delete it. The code in those pull requests is not lost — it still exists in the contributor's fork — but the pull request itself disappears from GitHub.
Deleting a repo you do not own
If you are a member of an organization and want to delete an organization repo, you need owner-level permissions for that organization. Contact the organization owner if you believe a repo should be deleted. They can review the request and make the decision.
If you forked someone else's repo and want to delete your fork, you can do so because you own your fork. Go to your fork's Settings, scroll to the Danger Zone, and delete it the same way you would delete any other repo you own. The original repo is unaffected.
Frequently Asked Questions
Can I undo a repo deletion?
No. Once you confirm the deletion by typing the repo name, GitHub permanently removes it. There is no undo button or recovery option. If you deleted a repo by mistake, your only option is to recreate it from a local backup if you have one.
What if I forgot to back up my code before deleting?
If you have a local clone on your computer, you still have the code. If you do not have a local copy and did not read it, the code is gone. GitHub does not retain deleted repos. In the future, always clone or read before deleting.
Does deleting my repo affect other people's forks?
No. Forks are independent copies on other people's accounts. Deleting your original repo does not touch their forks. They can continue to use and modify their copies, but pull requests back to your deleted repo will fail.
Can I delete a repo if I have pending pull requests?
Yes. The deletion will close all open pull requests automatically. The code in those pull requests still exists in the contributor's fork, but the pull request itself will no longer be visible on GitHub.
Is there a way to delete a repo without typing the name?
No. GitHub requires you to type the exact repo name as a confirmation step. This is intentional — it prevents accidental deletions. You must complete this step to proceed.