Deleting a GitHub repository removes it permanently from your account
To delete a repository on GitHub, go to the repository's settings page, scroll to the bottom, and click the "Delete this repository" button in the Danger Zone section. GitHub will ask you to type the repository name to confirm, then require you to enter your password or authenticate with your passkey. Once confirmed, the repository and all its contents — including commit history, branches, and pull requests — are gone and cannot be recovered.
Only the repository owner or someone with admin access can delete a repository. If you have push access but not admin access, you will not see the delete option. The process takes just a few minutes but is irreversible, so make sure you have backed up any code or data you need before you proceed.
Key Takeaways
- Only the repository owner or an admin can delete a repository; collaborators with push access cannot.
- Deletion is permanent and cannot be undone, so back up your code first if you need to keep it.
- GitHub requires you to confirm deletion by typing the repository name and entering your password or passkey.
- Deleting a repository does not affect your local copy of the code on your computer — only the remote version on GitHub is removed.
Step-by-step process to delete a repository
Start by navigating to the repository you want to delete on GitHub. Click the Settings tab near the top right of the repository page. You will see a left sidebar with options like General, Collaborators, and Branches.
Scroll all the way to the bottom of the Settings page. You will see a red section labeled "Danger Zone" with a button that says "Delete this repository". Click that button. GitHub will open a confirmation dialog asking you to type the full repository name (for example, my-project) to prove you intend to delete it.
Type the repository name exactly as shown. Then click the red "I understand the consequences, delete this repository" button. GitHub will prompt you to enter your password or authenticate with your passkey. Once you do, the repository is deleted immediately.
What happens to your local files after deletion
Deleting a repository on GitHub only removes the remote version stored on GitHub's servers. Your local copy — the folder on your computer where you have been working — remains untouched. All your files, branches, and commit history are still there.
If you want to keep working on the code, you can continue using your local repository. If you want to push your changes somewhere else later, you can create a new repository on GitHub and push your local code to it using the command git remote set-url origin [new-repository-url].
Permissions: who can delete a repository
Only the person who created the repository or someone with admin access to it can delete it. If you are a collaborator with push access, you will not see the delete option in Settings, even if you have been contributing to the repository for months.
If you need a repository deleted but do not have admin access, ask the repository owner to do it. If the owner is no longer active, GitHub does not transfer ownership to other collaborators, so you would need to contact GitHub Support for help.
Backing up your repository before deletion
Before you delete, consider whether you need to keep a copy of the code. The simplest way to back up is to clone the repository to your computer if you have not already. Open your terminal and run git clone [repository-url]. This creates a folder with all the code, branches, and history.
If you already have a local copy, you can create a bare clone — a backup that preserves the full repository structure — by running git clone --bare [repository-url] my-backup.git. You can store this file anywhere and restore from it later if needed. Another option is to export the repository as a ZIP file by clicking the green Code button on the repository homepage and selecting Download ZIP, though this does not preserve the full commit history.
Deleting a fork or archived repository
Forks follow the same deletion process as regular repositories. Go to Settings, scroll to the Danger Zone, and click Delete. The original repository is not affected — only your fork is removed.
If the repository is archived, you can still delete it the same way. Archiving a repository is different from deleting it; an archived repository is read-only and cannot receive new commits, but it remains visible and can be unarchived later. Deletion is permanent.
Frequently Asked Questions
Can I recover a repository after I delete it?
No. GitHub does not have an undo option for repository deletion. Once you confirm the deletion, the repository and all its contents are permanently removed. This is why backing up your code beforehand is important if you think you might need it later.
What happens to pull requests and issues when I delete a repository?
All pull requests, issues, and discussions tied to the repository are deleted along with it. If you need to preserve this information, take screenshots or export the data before you delete.
Can I delete a repository if it has open pull requests?
Yes. GitHub does not prevent you from deleting a repository with open pull requests. The pull requests will be deleted too. If you want to preserve them, close or merge them first, or ask the person who opened them to save the information.
Does deleting a repository affect my GitHub account or other repositories?
No. Deleting one repository does not affect your account, your other repositories, or your GitHub profile. Only that specific repository is removed.
What if I delete a repository by mistake?
Contact GitHub Support as soon as possible. They may be able to recover a recently deleted repository if you reach out within a short window, though recovery is not may provide. This is another reason to back up important code before deletion.