Delete forked repo from GitHub
Categories:
How to Delete a Forked Repository from GitHub

Learn the correct and safe methods to remove a forked repository from your GitHub account, including considerations for upstream changes and local clones.
Forking a repository on GitHub is a common practice for contributing to open-source projects or experimenting with code without affecting the original project. However, over time, you might accumulate many forked repositories that are no longer needed. Deleting these can help keep your GitHub profile clean and organized. This article will guide you through the process of safely deleting a forked repository from your GitHub account, along with important considerations.
Understanding Forked Repositories
A fork is essentially a copy of a repository. When you fork a project, you get a full copy of the repository, including all its files, commits, and branches, under your own GitHub account. This allows you to make changes, experiment, and even propose those changes back to the original (upstream) repository via a pull request. Deleting a fork only removes your copy; it does not affect the original upstream repository.
flowchart TD A[Original Upstream Repo] --> B{User Forks Repo} B --> C[User's Forked Repo] C -- Make Changes --> D[User's Forked Repo (Modified)] D -- Optional: Pull Request --> A C -- Delete Fork --> E[Fork Removed]
Lifecycle of a forked repository and deletion process
Prerequisites and Considerations Before Deleting
Before you proceed with deleting a forked repository, consider the following points to avoid unintended data loss or disruption:
- Local Clones: If you have cloned the forked repository to your local machine, deleting the remote fork will not automatically delete your local copy. You will need to remove the local directory manually.
- Unmerged Changes: Ensure that any changes you've made in your fork that you wish to contribute back to the upstream repository have been submitted as a pull request and ideally merged. Once the fork is deleted, any unmerged changes will be lost.
- Dependent Projects: Check if any other projects or scripts rely on your forked repository. Deleting it could break those dependencies.
- Permissions: You must have administrative access to your forked repository to delete it. This is typically the case since you own the fork.
Step-by-Step Guide to Deleting a Forked Repository
The process of deleting a forked repository is straightforward and is done directly through the GitHub web interface.
1. Navigate to Your Forked Repository
Log in to your GitHub account and go to the repository you wish to delete. You can find it under your list of repositories.
2. Access Repository Settings
Once on the repository's main page, click on the 'Settings' tab. This tab is usually located near the top of the page, next to 'Code', 'Issues', 'Pull requests', etc.
3. Scroll to the Danger Zone
On the Settings page, scroll down to the very bottom. You will find a section labeled 'Danger Zone'.
4. Delete the Repository
Within the 'Danger Zone', locate the 'Delete this repository' option and click the 'Delete this repository' button. GitHub will then ask you to confirm this action by typing the repository's name into a confirmation box. This is a crucial step to ensure you are deleting the correct repository.
5. Confirm Deletion
Carefully type the exact name of the repository into the confirmation box and click 'I understand the consequences, delete this repository'. Once confirmed, the repository will be permanently deleted from your GitHub account.
Cleaning Up Local Clones
After deleting the remote forked repository, you might also want to remove its local clone from your machine. This frees up disk space and removes outdated code.
cd /path/to/your/local/repo
rm -rf .git
cd ..
rm -rf your-repo-name
Commands to remove a local Git repository and its directory.
rm -rf
, double-check that you are in the correct directory to avoid accidentally deleting important files.