How to delete a repository in GitHub that was created using git init locally?

I created a local Git repository using git init, and now I want to completely remove it and start fresh. I’m not sure how to fully delete the local repo and its GitHub counterpart, if linked. What’s the correct way on how to delete a repository in GitHub that started with git init?

I’ve done this a few times when testing out side projects that didn’t pan out.

If you’re wondering how to delete a repository in GitHub that started with a local git init, here’s how I do it: First, go into the local folder and remove Git tracking with:

rm -rf .git

That wipes your local Git history completely. Then, on GitHub, go to the repo’s page, head to Settings > Danger Zone, and click Delete this repository. You’ll have to confirm the name, and just like that, it’s gone from both local and remote. Clean and simple.

Been through this recently when reorganizing some repos during a cleanup sprint.

Agree and adding on what @akanshasrivastava.1121 shared, if you’ve already pushed the repo to GitHub after running git init locally, I’d suggest deleting the remote first. That way, you avoid any stale connections. For me, the step-by-step on how to delete a repository in GitHub looks like this:

git remote remove origin
rm -rf .git

After that, I reinitialize the project:

git init
git remote add origin <new-repo-url>

Then push fresh to a brand-new GitHub repo. It’s like rebooting your codebase with zero history attached.

After years of building quick prototypes and experiments, I’ve found a more aggressive approach works best for me.

Honestly, if I no longer need the code at all, I skip the .git removal step and just delete the entire project folder from my machine. That, combined with deleting the repo from GitHub via Settings > Danger Zone, is the fastest way to get closure. This method nails it for anyone looking up how to delete a repository in GitHub and also clean up their local dev environment.

Just make sure you remove any additional local clones you might’ve made on other devices too. No loose ends!