Skip to content
codelicenses Earn $500+ per repo

How do you delete a GitHub repository?

Open the repository, go to Settings, scroll to the Danger Zone, choose Delete this repository, and type its name to confirm. It removes the code, the full commit history, issues, pull requests, releases and stars. Before you do it, know that archiving achieves everything deletion is usually for, and is reversible.

Updated 23 September 2026


The steps take thirty seconds. The part worth reading is what happens after you click, because most people deleting an old repository are trying to achieve something that deletion does not do, and destroying something they did not know they had.

The steps

Open the repository on GitHub. Click Settings. Stay on the General tab and scroll to the bottom, to the red-bordered section labelled Danger Zone.

Click “Delete this repository”. GitHub asks you to confirm by typing the repository’s full name, owner included. Type it, confirm, done.

If you are an organisation member rather than an owner, you may not have the permission and will not see the button. If you own the repository under a personal account, you always do.

What deletion removes

All of it. The code on every branch and tag. The complete commit history. Issues, pull requests, discussions, and their comments. Releases and the assets attached to them. Wiki pages. Stars, watchers, and the repository’s place in anyone’s lists. GitHub Pages sites served from it. Actions history.

There is one partial exception. GitHub keeps some deleted repositories restorable for a limited window, currently ninety days, from Settings, Repositories, Deleted repositories. Repositories that were part of a fork network when deleted are generally excluded. Treat restoration as a possibility, not a plan.

What survives anyway

This is where the expectations go wrong.

Every clone on every machine is a complete copy of the repository, history included. Forks of a public repository carry on as independent repositories, and the oldest one becomes the new upstream. Packages you published from the code stay published. Web archives keep what they crawled.

And if the repository was ever public, it has almost certainly been collected into at least one training corpus. Deleting it does not withdraw it from any of them. That is worth being clear-eyed about, because “I do not want AI trained on this” is a common reason people delete, and deletion does not achieve it. What happens to your code depends on choices made earlier, which is covered in is my private code used to train AI.

The same logic applies to secrets. A leaked key is in every clone and fork and may have been scraped within minutes. Rotate the credential. Deleting the repository afterwards is optional and changes nothing about the exposure.

┌─ WORTH CHECKING ─────────────────────────────────────────────────────┐
│                                                                      │
│  Private, finished, owned by you: $500+ each to AI labs.             │
│                                                                      │
│  [ See what my repos are worth ]                                     │
│                                                                      │
└──────────────────────────────────────────────────────────────────────┘

When deleting is the right call

Genuinely worthless repositories. The tutorial follow-along. The repository created by mistake. The scratch project from one afternoon with two commits in it. Nothing on this page argues for hoarding those.

Repositories you are contractually required to destroy. If a client agreement says deliverables are to be deleted on termination, that is a contract and this is not the page to second-guess it.

Duplicates. A second copy of something that lives elsewhere in full.

When archiving is the right call

Everything else, and especially the category people delete most: finished, dormant, private projects with years of history.

Archiving makes the repository read-only and keeps every byte. It stops appearing in your active work, stops accepting changes, and stops feeling like an obligation. It is reversible from the same settings page. The steps are in how to archive a GitHub repository.

It costs nothing to hold and it keeps open an option that deletion closes permanently.

The thing you are about to destroy

A finished private repository has two things in it: the code, and the record of how the code came to be. Most developers value the first and regard the second as noise.

The market values them the other way round. When source code is licensed for training coding models, the commit history is priced separately and it is the large majority of the token volume, because every commit carries a diff, a message, and a position in a sequence, and years of that is far more text than the code it produced. The failed approaches, the reverts, the four attempts at one bug: that is the signal a snapshot cannot provide.

Deleting the repository destroys that record permanently. Archiving keeps it intact. Squashing, incidentally, does the same damage more quietly, which is covered in should you squash commits.

If the repository is private and yours, it may be worth more than you think, and the only way to lose that value entirely is the button in the Danger Zone. Before pressing it, it takes a minute to estimate what the repository holds, and a little longer to check whether it qualifies.

Common questions

Can a deleted GitHub repository be restored?
Sometimes. GitHub keeps some deleted repositories restorable for a limited window, currently ninety days, from Settings, Repositories, Deleted repositories. Repositories that were part of a fork network at deletion are generally not restorable. Do not rely on it.
Does deleting a repository delete its forks?
For a public repository, no. The forks survive and the oldest one becomes the new upstream of the network. For a private repository, forks are deleted along with it.
Does deleting a repository remove my code from the internet?
No. Clones on other machines, forks, package registries, archived copies, and anything already collected into a training corpus are untouched. Deletion removes GitHub's copy, nothing else.
Does deleting a repository fix a leaked secret?
No. The secret is in every clone and fork and may already have been scraped. Rotate the credential. That is the fix, whether or not you delete anything.
What is the difference between deleting and archiving?
Archiving makes the repository read-only and keeps everything: code, history, issues, stars. It is reversible. Deletion removes all of it and usually cannot be undone. If the goal is to stop looking at it, archive.

WORTH CHECKING

Earn $500+ on every repo you never open.

Private, finished, owned by you: $500+ each to AI labs.

Non-exclusive, so you keep the code and are paid again on every re-license.

See what my repos are worth