How to Delete a Repo in GitHub: What You Need to Know Before You Do It
Deleting a GitHub repository is a permanent action — and GitHub makes sure you really mean it before letting you go through with it. Whether you're cleaning up old projects, removing a test repo, or shutting down something you no longer maintain, the process is straightforward. But there are a few things worth understanding before you hit that final button. 🗑️
What Happens When You Delete a GitHub Repo
When you delete a repository on GitHub, the following happens immediately:
- The repository and all its contents are removed — code, commit history, branches, tags, releases, and wikis
- Issues and pull requests are deleted permanently
- Forks are not deleted — any forks others have made of your repo continue to exist independently
- The repository name becomes available again — someone else (or you) can create a new repo with the same name
GitHub does not offer a built-in "undo" for this. Once it's gone, it's gone — unless you have a local clone or an external backup.
Who Can Delete a GitHub Repository
Not everyone with access to a repo can delete it. GitHub enforces permission levels:
| User Role | Can Delete? |
|---|---|
| Repository Owner | ✅ Yes |
| Organization Owner | ✅ Yes (for org repos) |
| Admin collaborator | ❌ No (by default) |
| Write/Read collaborator | ❌ No |
For personal repositories, only the account owner can delete. For organization repositories, you need to be an organization owner, or an admin who has been explicitly granted the "delete repositories" permission under organization settings.
How to Delete a GitHub Repository (Step by Step)
On GitHub.com (Browser)
- Navigate to the repository you want to delete
- Click the Settings tab (you need to be the owner or have org-level delete permissions)
- Scroll to the bottom of the Settings page to the Danger Zone section
- Click Delete this repository
- A confirmation dialog appears — GitHub will ask you to type the full repository name to confirm
- Click I understand the consequences, delete this repository
The repo is deleted immediately after confirmation.
Via GitHub CLI
If you use the GitHub CLI (gh), you can delete a repo from the terminal:
gh repo delete OWNER/REPO-NAME GitHub CLI will prompt you to confirm. Add --yes to skip the confirmation prompt in scripts:
gh repo delete OWNER/REPO-NAME --yes You'll need to be authenticated and have owner-level access for this to work.
Via GitHub API
For automated workflows, the GitHub REST API supports repository deletion:
DELETE /repos/{owner}/{repo} This requires a personal access token (PAT) or OAuth token with the delete_repo scope. Without that specific scope, the API call will return a 403 error even if your token has broad repo access.
Common Reasons the Delete Option Is Grayed Out or Missing
If you can't find or use the delete option, the most likely causes are:
- You're not the repository owner — collaborators with write or admin access don't automatically have deletion rights
- Organization-level restrictions — org owners can disable the ability for even admins to delete repos
- You're viewing a fork — the settings exist, but your permissions may differ from the source repo
- Two-factor authentication (2FA) requirements — some organizations enforce 2FA before certain destructive actions are allowed
Before You Delete: Things Worth Checking
Deleting is permanent, so it's worth a quick review:
- Do you have a local clone? If not and the code matters, clone it first with
git clone - Are there open integrations? CI/CD pipelines, webhooks, or third-party services pointing to this repo will break immediately
- Is the repo linked to GitHub Pages? The hosted site will go offline
- Are there active collaborators? Anyone with access will lose it instantly — no notification is sent to them
- Does another repo depend on this one as a submodule? Those references will break
Archiving vs. Deleting: A Different Option
If your goal is to stop active development without permanently losing the code, archiving is worth considering instead. An archived repository:
- Becomes read-only — no new pushes, issues, or pull requests
- Remains publicly visible (if it was public)
- Preserves full history and can be unarchived at any time
You'll find the archive option in the same Danger Zone section of Settings. It's a softer alternative when the code still has reference value.
Transferring Instead of Deleting
Another option often overlooked: repository transfer. If someone else needs to own the project going forward, you can transfer it to another user or organization rather than deleting it. The transfer option is also in the Danger Zone and preserves all history, issues, and forks under the new owner.
The Variables That Change This Decision 🔍
Whether deletion is the right move — and how straightforward the process is — depends on factors specific to your situation:
- Personal vs. organization repo — organization repos involve additional permission layers
- Public vs. private — public repos may have been forked or referenced externally
- Active integrations — the more services connected, the larger the downstream impact
- Team size — solo projects have no collaborators to notify; team projects do
- Backup status — whether a local clone or external backup exists changes how risky deletion is
The mechanics of deleting a GitHub repo are simple. What varies is whether deletion is the right action, and whether the side effects matter in your specific setup.