'Cannot remove git repository completely
I have been using git on windows-msysgit. Whenever I try to remove a repository completely either using explorer or using
$ git rm -rf ptp/
fatal: Not a git repository (or any of the parent directories): .git
it errors out "The data present in the reparse point buffer is invalid" or the fatal error above.
What's wrong with me/git?
Thanks in advance
Solution 1:[1]
To remove a git repo, just do rm -rf ptp/. That's it.
git rm is used to move items from the index [the staging area for changes / new files], not to delete git repositories.
Solution 2:[2]
To get rid of the git repository on Windows do this:
Win+R, Type cmd, Enter.
> cd c:/path/to/parent/of/ptp-repo
> rmdir /S /Q ptp
Or if it fails then check who locks the directory and delete it by hands from Explore.
Most likely some process holds a lock on files/dirs in your repo.
Solution 3:[3]
I tried to remove GIT on my windows-XP, by means of the Windows/Configuration/Software menu. After some error message (which I cannot remember), it removed all files. I checked it, and there are no files with ptp in the name left on the entire system.
A problem remained however: each time I opened windows-explorer, a nasty error message came calling for a dll file that wasn't there anymore.
When checking the registry, there were many traces to GIT left in the registry. I removed them carefully by hand, which seems to have solved the problem. This is of course a dangerous path, but I had no choice. Perhaps it is a good idea to look into the Windows-deinstallation script very carefully.
Stef Joosten
Solution 4:[4]
On Windows 10, try running cygwin console as admin and rm -rf the dir.
Solution 5:[5]
I have also just experienced this odd problem on windows 10: An empty .git folder simply would not delete and a restart of windows did not remedy it, nor did rmdir .git, nor did rm -rf .git.
Similarly to another suggestion, I used ubuntu (instead of cygwin) for windows (https://tutorials.ubuntu.com/tutorial/tutorial-ubuntu-on-windows#0) and issued an rm -rf .git, that worked perfectly
Solution 6:[6]
This solution should make it possible to delete any locked files and folders without installing any new programs:
- Go to your Resource Monitor (in the Task Manager)
- Go to the CPU tab
- Search for your file in the "Associated Handles"
- Now you'll see which process(es) are locking your file (it's likely explorer.exe)
- Close those processes (be careful, this might delete unsaved work)
- Delete your previously locked files, this should work without a problem now.
- Optional: Start processes again (for explorer.exe: Go to Task Manager, File ? New task ? type in "explorer.exe")
Solution 7:[7]
This should work:
On Git Bash do:
$ git remote remove <name>
To see your remote list:
$ git remote
Solution 8:[8]
When I want to remove a GIT repo on Windows... i very simply delete (or move) the .git directory where the repo sits... I do this straight from Explorer... it hasn't failed me yet!
Solution 9:[9]
I have a third partition, on a dual boot with Windows 7 and Fedora Linux, and I realized I had a file open in vim in a terminal, and that was causing a .fuse_hidden... file to not be deletable.
When I closed the file in vim, I was able to delete the .git directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | rmk |
| Solution 2 | Dmytrii Nagirniak |
| Solution 3 | |
| Solution 4 | Peteter |
| Solution 5 | andmar8 |
| Solution 6 | Redaniat |
| Solution 7 | Marcos Lopes |
| Solution 8 | g19fanatic |
| Solution 9 | Brady Trainor |
