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).

- 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.
- Go to your forked repo.
- Click Settings > Delete.
- 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:
- Open the repo and go to the file.
- Click the trash icon (🗑️) at the top right.
- 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:
- Navigate to each file inside the folder and delete them.
- 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:
- Go to Code > Branches.
- 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:
- Open GitHub Desktop
- Right-click your repo in the list
- 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:
- ⚠️ Backup critical data first
- ✅ Verify you’re in the correct repository
- 🧾 Use commit messages if deleting files, for clarity
- 🛠️ Use tools like Everhour to manage time and track file history
Want more GitHub management guides?
- How to Push to GitHub from VSCode
- GitHub Personal Access Tokens: How to Create & Use
- GitHub vs GitLab: Which One Wins in 2025?