Productivity Tools › Github

How to Delete a Repository in GitHub (2025 Guide)

Maria, April 18, 2025
how to delete a repository in github (2025 guide)

Wondering how to delete a repository in GitHub without making mistakes? Whether you’re cleaning up unused projects or reorganizing your work, this guide shows you step-by-step instructions on how to delete a repository in GitHub. We’ll cover everything from locating the right settings to confirming the deletion—plus mention helpful tools like our GitHub time tracking integration to better manage your active repos before you remove the old ones.

What Happens When You Delete a GitHub Repo?

Before you learn how to delete a repository in GitHub, here’s what happens:

  • 🗑️ The entire repository is permanently removed (including issues, pull requests, wikis, etc.).
  • 🚫 The action is irreversible unless you’ve created a local backup.
  • 🔐 You must be the owner or have admin permissions to delete the repository.
  • 💡 If the repo is public, its forks will remain.


How to Delete a Repository in GitHub (Web Interface)

Follow these simple steps:

  • Log in to your GitHub account.
  • Navigate to the repository you want to delete.
  • Click on the Settings tab (top menu).
how to delete a repository in github (2025 guide)
  • Scroll down to the “Danger Zone”.
  • Click “Delete this repository”.
  • Type the repository name as confirmation.
  • Click the red “I understand the consequences” and confirm.

How to Delete a GitHub Repo Using Git Bash / CLI

You can’t directly delete a repo from the command line. However, you can use GitHub’s API or delete the remote origin from your local system.

To remove the remote origin from your local repo:

git remote remove origin

To delete a repo via GitHub CLI:

gh repo delete username/repo-name --confirm

Install GitHub CLI from cli.github.com if you haven’t already.


How to Delete a Forked Repository in GitHub

Deleting a fork is the same as deleting any other repo.

  1. Go to your forked repo.
  2. Click Settings > Delete.
  3. Confirm repo name → Delete.

This does not affect the original repo you forked from.


How to Delete a File or Folder in a GitHub Repository

Delete file from web UI:

  1. Open the repo and go to the file.
  2. Click the trash icon (🗑️) at the top right.
  3. Scroll down and commit changes with a message.

Delete folder from web UI:

GitHub does not support folder deletion directly if it’s not empty.

Steps:

  1. Navigate to each file inside the folder and delete them.
  2. Once the folder is empty, it disappears from the repo.

Or, use Git:

git rm -r folder-name
git commit -m "Deleted folder"
git push origin main

How to Delete All Files in a GitHub Repo

To clear the repo but keep it alive:

git rm -r *
git commit -m "Cleared repo content"
git push origin main

Or delete via GitHub UI using the trash icon for each file.


How to Delete a Branch in a GitHub Repository

Via GitHub UI:

  1. Go to Code > Branches.
  2. Find your branch and click the trash icon.

Via Terminal:

# Delete local branch
git branch -d branch-name

# Delete remote branch
git push origin --delete branch-name

How to Delete a Repo from GitHub Desktop

GitHub Desktop does not support remote repo deletion directly.

To remove a local clone:

  1. Open GitHub Desktop
  2. Right-click your repo in the list
  3. Click “Remove” → Choose to delete or keep files locally

For remote deletion, go to GitHub.com and follow the web method.


❓ FAQs: GitHub Repo Deletion

Can I recover a deleted GitHub repository?

➡️ No. Once deleted, it’s gone unless you have a backup.

Does deleting a fork delete the original repo?

➡️ No. Forks are independent once created.

Can I delete just a file from the GitHub repo?

➡️ Yes. Use the UI or GitHub Desktop to remove files individually.

What happens to stars and forks after deletion?

➡️ Forks remain. Stars are lost.

Can I undo git rm after deletion?

➡️ Only before you commit. Use git restore or git reset if uncommitted.


Final Thoughts: Deleting Repos Safely

Now that you know how to delete a repository in GitHub, always remember to:

  1. ⚠️ Backup critical data first
  2. ✅ Verify you’re in the correct repository
  3. 🧾 Use commit messages if deleting files, for clarity
  4. 🛠️ Use tools like Everhour to manage time and track file history


Want more GitHub management guides?

Maria

A dedicated content enthusiast with extensive experience in international teams and projects of all sizes. Maria thrives on creativity and attention to detail, fueled by a love for fantasy novels, music, classic black-and-white films, and always finding ways to make things better.