How to Delete a Repo From GitHub: What You Need to Know Before You Do It
Deleting a GitHub repository is a permanent action — and GitHub makes it deliberately difficult to do by accident. Whether you're cleaning up old projects, removing a test repo, or shutting down a public codebase, the process is straightforward, but there are a few things worth understanding before you click that button.
What Happens When You Delete a GitHub Repository
When you delete a repo on GitHub, the following happens immediately:
- The remote repository (hosted on GitHub's servers) is permanently removed
- All issues, pull requests, wikis, and project boards tied to that repo are deleted
- GitHub Actions workflows and their history are erased
- Any GitHub Pages site hosted from that repo goes offline
- Forks are not deleted — if other users have forked your repo, their copies remain intact and independent
What deletion does not affect is any local clone of the repository. If you or a collaborator has a local copy on a machine, that code still exists there. The Git history, commits, and files remain in any local clone, completely unaffected by the remote deletion.
How to Delete a Repository on GitHub (Step by Step)
Via the GitHub Website
- Navigate to the repository you want to delete
- Click the Settings tab (you must be the repo owner or have admin access)
- Scroll to the bottom of the Settings page to the Danger Zone section
- Click Delete this repository
- GitHub will prompt you to type the full repository name to confirm — this is a deliberate friction step
- Click the final confirmation button
The entire process takes about 30 seconds, but the name-typing confirmation is GitHub's way of forcing you to be intentional. It's easy to ignore how permanent this is until you're typing out the repo name manually.
Via the GitHub CLI
If you work in the terminal, you can delete a repo using the GitHub CLI:
gh repo delete OWNER/REPO-NAME You'll be prompted to confirm. Add --yes to skip the confirmation prompt if you're scripting it — but use that flag carefully.
Via the GitHub API
For developers automating repository management, the GitHub REST API supports deletion:
DELETE /repos/{owner}/{repo} This requires a personal access token (classic or fine-grained) with the delete_repo scope enabled. Organization repos may require additional permissions depending on how the org's access controls are configured.
🔐 Permissions: Who Can Actually Delete a Repo
Not everyone with access to a repository can delete it. GitHub enforces a clear permission hierarchy:
| Scenario | Who Can Delete |
|---|---|
| Personal repository | Only the repo owner |
| Organization repository | Organization owners, or members explicitly granted admin role on that repo |
| Forked repository | Owner of the fork (doesn't affect the original) |
| Archived repository | Same permissions apply — archiving doesn't restrict deletion |
If you're a collaborator with write access but not admin access, the Settings tab either won't appear or won't show the Danger Zone. You'll need to ask the repo owner or an org admin to handle the deletion.
Recovering a Deleted Repository
GitHub does have a short window for restoring deleted repositories — but it's limited.
Organization repositories can be restored by an organization owner within 90 days of deletion, through the organization's Settings under "Deleted repositories."
Personal repositories are harder to recover. GitHub does not provide a self-service restore option for personal repos. If you need one restored, you'd need to contact GitHub Support, and there's no guarantee of recovery — especially if significant time has passed.
This asymmetry matters. If you're working inside an org and there's any chance you'll want the repo back, the 90-day window gives you a meaningful safety net. For personal repos, deletion is effectively permanent from the moment you confirm it.
Before You Delete: Variables That Change the Right Approach ⚠️
Whether deleting a repo is straightforward or complicated depends on your specific situation:
Public vs. private repo — Deleting a public repo removes it from search results and breaks any inbound links, which matters if others have referenced it in documentation, blog posts, or dependency lists.
Active forks or dependents — If your repo is a library or package that others depend on, deletion without notice can break their projects. Tools like GitHub's Dependents graph (under Insights) show how widely your repo is used.
CI/CD integrations — If the repo is connected to external services (Vercel, Netlify, CircleCI, etc.), those pipelines will break immediately on deletion. You may need to clean up webhooks and connected apps separately.
Team or org context — In organizational settings, deleting a repo may affect billing, archival compliance requirements, or team workflows in ways a personal account deletion wouldn't.
Local backup status — If the only copy of your code exists on GitHub (no local clone, no backup), deletion means that code is gone. It's worth pushing or exporting a local copy before proceeding if there's any chance you'll want it later.
Alternatives to Deletion Worth Considering
If your goal is reducing clutter or stopping active development rather than permanently removing a repo, GitHub offers a few softer options:
- Archive the repository — Makes it read-only, removes it from active searches, but preserves the full history and all content
- Make it private — Hides it from public view without deleting anything
- Transfer ownership — Hands the repo to another user or organization instead of deleting it
Each of these preserves the codebase in a way that deletion does not.
🗂️ The Decision Depends on Your Setup
The mechanics of deletion are simple. What varies is whether deletion is actually the right move — and that depends on who else uses the repo, what depends on it, whether you have backups, and what your organization's policies look like. The steps above will work for anyone, but which step to take first looks different depending on the size of your setup and how connected that repo is to other systems.