The fastest way to delete a Git repository
To delete a Git repository, you delete the hidden .git folder that Git creates when you initialize a repository. On Mac or Linux, open Terminal, navigate to your project folder, and run rm -rf .git. On Windows, open Command Prompt or PowerShell, navigate to your project folder, and run rmdir /s .git. After you run this command, the folder is no longer a Git repository — your project files remain, but Git stops tracking them.
If your repository is hosted on GitHub, GitLab, Bitbucket, or another platform, deleting the local .git folder does not remove it from the server. You must delete the remote repository separately through the website's settings. The steps differ by platform, but all require you to go to the repository settings and choose an option like "Delete this repository".
Key Takeaways
- Deleting the .git folder on your computer removes the repository locally, but your project files stay intact.
- On Mac or Linux, use rm -rf .git; on Windows, use rmdir /s .git in Command Prompt or PowerShell.
- Deleting the local repository does not affect a remote copy on GitHub, GitLab, or Bitbucket — you must delete that separately.
- If you have uncommitted changes or branches you want to keep, back up your project folder before deleting the repository.
Deleting a local repository on Mac or Linux
Navigate to your project folder in Terminal. Type ls -la to list all files, including hidden ones. You should see a folder named .git. Run rm -rf .git to delete it. The -r flag tells the system to delete recursively (everything inside the folder), and -f forces deletion without asking for confirmation.
After the command completes, your project folder still contains all your source code, configuration files, and other project files. Git simply stops tracking changes. If you run git status now, you will see an error saying "fatal: not a git repository".
Deleting a local repository on Windows
Open Command Prompt or PowerShell and navigate to your project folder using cd. Type dir to list files. If you do not see a .git folder, enable viewing hidden files: in File Explorer, go to View and check "Hidden items". Once you can see .git, run rmdir /s .git in Command Prompt or Remove-Item -Recurse -Force .git in PowerShell.
The /s flag in Command Prompt deletes the folder and everything inside it. PowerShell's -Recurse flag does the same. After deletion, your project files remain, and Git no longer tracks the folder.
Removing a repository from GitHub
Log in to GitHub and open the repository you want to delete. Click the Settings tab near the top right. Scroll down to the bottom of the page and find the "Danger Zone" section. Click Delete this repository. GitHub will ask you to type the repository name to confirm — this prevents accidental deletion.
After you confirm, the repository is permanently removed from GitHub. Anyone with a link to the repository will see a 404 error. If other people have cloned the repository to their computers, their local copies remain, but they cannot push changes back to GitHub.
Removing a repository from GitLab
Log in to GitLab and open the repository. Click Settings in the left sidebar, then scroll down and click General. Expand the "Advanced" section. Click the red Delete project button. GitLab will ask you to type the project name and may ask for your password to confirm.
Once deleted, the repository is gone from GitLab's servers. Local copies on developers' computers are unaffected, but they cannot push or pull from the remote repository anymore.
Removing a repository from Bitbucket
Log in to Bitbucket and open the repository. Click the settings icon (gear) in the top right. In the left sidebar, click Repository details. Scroll down and click the red Delete repository button. Bitbucket will ask you to confirm by typing the repository name.
The repository is then permanently removed from Bitbucket. Any local clones will lose their connection to the remote, and pushing or pulling will fail.
What happens to your files after deletion
Deleting a Git repository does not delete your project files. When you delete the .git folder, you remove only Git's tracking data — the history, branches, and metadata. Your source code, images, configuration files, and everything else in the project folder stays where it is.
If you delete a remote repository on GitHub, GitLab, or Bitbucket, the files on your computer are still there. The remote copy is gone, but your local copy remains. If you want to keep the project but stop using Git, delete the .git folder and keep the rest. If you want to remove the project entirely, delete the whole project folder.
Frequently Asked Questions
Can I undo a repository deletion?
If you deleted only the local .git folder, you can restore it from a backup or clone the remote repository again. If you deleted the remote repository on GitHub or another platform, recovery depends on whether the platform keeps backups — most do not. Contact the platform's support if you need to check.
What if I have uncommitted changes I want to save?
Before deleting the .git folder, copy your project folder to a backup location. Then you can delete the repository safely. If you have changes in branches you have not merged, those changes are lost when you delete .git, so backing up first is important.
Do I need to delete the remote repository if I only want to stop using Git locally?
No. You can delete the local .git folder and keep the remote repository on GitHub or another platform. Your project files stay on your computer, and the remote copy stays on the server. You simply stop using Git to track changes.
What if the .git folder is hidden and I cannot see it?
On Mac, press Command + Shift + Period in Finder to show hidden files. On Windows, open File Explorer, go to View, and check "Hidden items". On Linux, hidden files starting with a dot are shown by default in most file managers, or use ls -la in Terminal.
Can I delete a repository if other people have cloned it?
Yes. Deleting the remote repository on GitHub or another platform does not affect copies that other people have already cloned to their computers. Their local repositories remain, but they cannot push changes back or pull new changes from the remote.