The fastest way to delete a Git repo
To delete a Git repository, you delete the folder that contains it. On Windows, Mac, or Linux, find the folder where your repo lives, right-click it, and choose Delete (or move it to Trash). That's it — the repository is gone.
If you cloned the repo from GitHub, GitLab, or another hosting service, deleting the local folder does not affect the remote version. The copy on the server stays there unless you delete it separately. If you created the repo locally and never pushed it anywhere, deleting the folder removes it completely.
The reason this works is that Git stores everything it needs inside a hidden folder called .git within your project directory. When you delete the whole folder, you delete that hidden folder along with it, and Git no longer recognizes it as a repository.
Key Takeaways
- Deleting the project folder removes the local Git repository; the remote copy on GitHub or GitLab remains unless you delete it separately.
- Git stores all version history and metadata in a hidden .git folder inside your project — deleting the parent folder removes the entire repository.
- On Mac and Linux, you can use the command line to delete a repo with rm -rf folder-name, but only if you are certain you want to remove it permanently.
- Before deleting, push any work you want to keep to a remote server, or create a backup copy of the folder in case you need the history later.
Deleting the local repo using the command line
If you prefer the terminal, you can delete a repository from the command line. On Mac or Linux, open Terminal, navigate to the parent directory (the folder that contains your repo), and type rm -rf repo-name, replacing repo-name with the actual folder name. Press Enter, and the folder and all its contents vanish immediately — there is no undo.
On Windows, open Command Prompt or PowerShell, navigate to the parent directory, and type rmdir /s /q repo-name. The /s flag removes the folder and everything inside it; the /q flag skips the confirmation prompt. Again, this is permanent.
The command line approach is faster if you delete repos often, but it is riskier because there is no trash or recycle bin — the deletion happens immediately. If you are new to the command line, the graphical method (right-click and delete) is safer because you can recover the folder from Trash or Recycle Bin if you change your mind within a few minutes.
What happens to the remote repository
Deleting your local folder does not touch the remote repository on GitHub, GitLab, Bitbucket, or wherever you pushed your code. The remote copy stays there, and anyone with access can still clone it or push changes to it.
If you want to delete the remote repository as well, you need to go to the hosting service and delete it there. On GitHub, go to the repository page, click Settings, scroll to the bottom, and click Delete This Repository. You will be asked to type the repository name to confirm. On GitLab, the option is under Settings > General > Advanced. Each service has its own process, but they all require you to confirm the deletion by typing the repo name.
If you are the only person using the repository and you are sure you do not need the history, deleting both the local and remote copies is fine. If others are working on the project or you might need the history later, keep the remote copy and only delete the local folder.
Backing up before you delete
If the repository contains work you might need later, create a backup before you delete. The simplest way is to copy the entire folder to another location — your Documents folder, an external drive, or cloud storage. This preserves the full Git history in case you need to recover it.
Another option is to create a bare repository — a copy that stores only the Git metadata without a working directory. This takes up less space and is useful if you want to archive the history without keeping the actual project files. To create a bare copy, open Terminal or Command Prompt in the parent directory and type git clone --bare original-repo-name backup-repo.git. The .git extension signals that it is a bare repository.
If the repo is already on GitHub or GitLab, you do not need to back it up locally — the remote server is your backup. You can always clone it again later if you need the history.
Removing a repo from Git without deleting the files
Sometimes you want to keep your project files but stop tracking them with Git. This is different from deleting the repository — you are removing Git's control, not the folder itself.
To do this, delete only the .git folder inside your project. On Mac or Linux, open Terminal, navigate into your project folder, and type rm -rf .git. On Windows, the .git folder is hidden by default. Open File Explorer, go to View > Show Hidden Items, find the .git folder, right-click it, and delete it. Your project files remain, but Git no longer tracks them.
This is useful if you want to stop using version control for a project, convert it to a different version control system, or remove Git tracking before uploading the project somewhere that does not need Git history.
Cleaning up after deletion
After you delete a repository, Git may still have references to it in your global configuration or in your IDE. If you use Visual Studio Code, GitHub Desktop, or another tool that lists your recent repositories, you might see the deleted repo in the history. This does not cause problems — it just clutters the interface.
In GitHub Desktop, right-click the repository in the left sidebar and choose Remove. In Visual Studio Code, the repo will simply disappear from the Recent Repositories list the next time you restart the application. These are just shortcuts to the folder; deleting the folder automatically breaks the shortcut.
If you cloned the repo from a remote server and want to remove it from your local machine completely, also check your SSH keys and credentials. If you generated an SSH key specifically for that repository, you can delete it from your GitHub or GitLab account settings under SSH and GPG Keys. This is optional unless you want to revoke access entirely.
Frequently Asked Questions
Can I recover a deleted Git repository?
If you deleted only the local folder and the remote repository still exists on GitHub or GitLab, you can clone it again. If you deleted both the local and remote copies, recovery depends on whether you have a backup. If you backed up the folder or created a bare repository, you can restore it from that backup. If not, the repository is gone permanently.
What is the difference between deleting the repo and deleting the .git folder?
Deleting the entire folder removes your project files and Git history. Deleting only the .git folder keeps your files but removes Git tracking. Use the first method if you no longer need the project; use the second if you want to keep the files but stop using version control.
Do I need to delete the remote repository if I delete the local one?
No. Deleting the local folder does not affect the remote copy. Delete the remote repository only if you want it gone from GitHub, GitLab, or your hosting service. If you might need the history later, leave the remote copy and delete only the local folder.
Will deleting a repository affect other people's clones?
No. If others have cloned the repository, they have their own local copies with full history. Deleting your local or remote copy does not touch their copies. They can continue working and pushing changes, though they will not be able to push to the remote if you deleted it.