Delete a Git repository by removing the hidden .git folder from your project directory
A Git repository is the folder that Git uses to track your project's history. When you delete the repository, you remove that tracking system — but your actual files stay put. The simplest way is to delete the hidden .git folder that Git creates when you first set up version control on a project.
After deletion, your project folder becomes a regular folder with no version history. You can still see and use all your files. If you had pushed your work to GitHub, GitLab, or another remote service, those copies remain untouched — deleting your local repository does not affect them.
Key Takeaways
- Deleting a Git repository removes only the .git folder, leaving all your actual project files intact and usable.
- On Mac and Linux, use rm -rf .git in your project folder; on Windows, delete the .git folder through File Explorer or use rmdir /s .git in Command Prompt.
- If your repository is on GitHub or GitLab, deleting your local copy does not remove the remote version — you must delete that separately if you want it gone.
- After deletion, your project folder becomes a normal folder with no version history, but all files remain readable and editable.
Delete the .git folder on Mac or Linux
Open the terminal and navigate to your project folder. Type ls -la to see all files, including hidden ones. You should see a folder named .git — that is what Git uses to store your history.
Run rm -rf .git to delete it. The -rf flags tell the system to remove the folder and everything inside it without asking for confirmation. Once the command finishes, your repository is deleted. Run ls -la again to confirm the .git folder is gone.
Delete the .git folder on Windows
The .git folder is hidden by default in Windows. Open File Explorer and navigate to your project folder. Click the View menu at the top, then check the box for "Hidden items" to make hidden files visible. You should now see the .git folder.
Right-click the .git folder and select Delete. Windows will ask you to confirm; click Yes. If you prefer the command line, open Command Prompt, navigate to your project folder, and run rmdir /s .git. Type y when prompted to confirm.
What happens to your files after deletion
All your project files remain exactly as they are. You can still open, edit, and use them normally. The only thing that disappears is the version history — Git no longer tracks changes, and you cannot run commands like git log or git diff anymore.
If you want to start using Git again on this project later, you can run git init to create a new repository. This will start fresh with no previous history.
Deleting a repository on GitHub, GitLab, or other remote services
Deleting your local .git folder does not touch the copy on GitHub or GitLab. If you want to remove the remote repository as well, you must delete it separately on that service.
On GitHub, go to your repository page, click Settings, scroll to the bottom, and click Delete this repository. You will need to type the repository name to confirm. On GitLab, go to Settings, then General, and click Delete project. Other services have similar options in their settings or admin panels.
When to delete a repository
Delete a repository when you no longer need version control for a project — for example, if you are archiving old work, cleaning up test folders, or moving a project to a different system. You might also delete it if you accidentally created a repository in the wrong folder and want to start fresh elsewhere.
If you are unsure whether you need the history, consider keeping the repository but archiving it instead. You can always delete it later, but once the .git folder is gone, the history is gone for good.
Recovering a deleted repository
Once you delete the .git folder, the local history is gone and cannot be recovered from your computer. However, if you had pushed your work to GitHub, GitLab, or another remote service before deleting, that copy still exists and you can clone it back down.
If you deleted both the local repository and the remote one, recovery is not possible. This is why it is a good idea to push important work to a remote service before deleting anything locally.
Frequently Asked Questions
Does deleting the .git folder delete my actual project files?
No. The .git folder only stores version history. Your project files remain untouched and fully usable. You can still open, edit, and work with them normally after deletion.
Can I recover a deleted repository?
If you had pushed your work to GitHub or GitLab before deleting, you can clone it back. If you deleted both the local and remote copies, recovery is not possible. Always push important work to a remote service before deleting locally.
What is the difference between deleting a local repository and a remote one?
Deleting the .git folder on your computer removes only your local version history. The copy on GitHub or GitLab remains unchanged. You must delete the remote repository separately through that service's settings if you want it gone.
Can I delete a repository and start fresh with Git on the same project?
Yes. After deleting the .git folder, run git init in your project folder to create a new repository. This starts version control from scratch with no previous history.
Is it safe to delete a .git folder?
It is safe as long as you have pushed your work to a remote service or backed it up elsewhere. Once deleted, the local history cannot be recovered. Always verify you have a copy elsewhere before deleting.