Cannot remove git repository completely

34,618

Solution 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

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

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

On Windows 10, try running cygwin console as admin and rm -rf the dir.

Share:
34,618
Aleyna
Author by

Aleyna

Updated on May 03, 2022

Comments

  • Aleyna
    Aleyna almost 2 years

    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

    • Dmytrii Nagirniak
      Dmytrii Nagirniak about 14 years
      Does the windows restart help? :)
    • Aleyna
      Aleyna about 14 years
      No! It is still there. I can only rename the parent folder but cannot remove the file ta05636 with size of 0 bytes. Is this a measure Microsoft takes against Git? :)
    • g19fanatic
      g19fanatic over 13 years
      Loading Windows in Safe mode and erasing will definately 'fix' this issue. Some process in your normal startup is accessing that file and Windows isn't allowing you to erase it. Using safe mode, you will basically limit which processes start up, thus allowing you to delete it. If the process STILL starts up in safe mode, you might have to boot your computer with a linux LIVE disc (pick your flavor) and delete it that way...
    • g19fanatic
      g19fanatic over 13 years
      Knoppix is a good choice. knoppix.net
    • g19fanatic
      g19fanatic over 13 years
      Live Mint is also a great choice! linuxmint.com/edition.php?id=65
  • rjh
    rjh about 14 years
    +1, but be warned -- git rm will delete files from your working directory, provided they are also removed from the index, and have no unstaged or staged changes. Fortunately, in these cases you can always get them back from the version history.
  • Aleyna
    Aleyna about 14 years
    Here is the outcome :( D:\Projects\ptp>rmdir /S /Q ptp ptp\GIT~1\ta05636 - The data present in the reparse point buffer is invalid. I tried WhoLockMe but it chrashed as I am using Win7. Is there any other way to discover 'the locker'?
  • Aleyna
    Aleyna about 14 years
    No way! $ rm -rf ptp/ rm: cannot remove directory ptp/.git': Directory not empty rm: cannot remove directory ptp': Directory not empty And got that: hoppala@HOPPALANINYERI /d/Projects/ptp/ptp/.git $ ls ta05636 hoppala@HOPPALANINYERI /d/Projects/ptp/ptp/.git $ rm -rf ta05636 hoppala@HOPPALANINYERI /d/Projects/ptp/ptp/.git $ ls ta05636
  • Aleyna
    Aleyna about 14 years
    I used Unlocker. It says there is no locking handler on the folder :s It didnt remove the file even though I went with 'delete on the next restart' option.
  • rmk
    rmk about 14 years
    That's definitely odd. This probably has more to do with some problem on Windows, rather than with git itself.
  • Aleyna
    Aleyna about 14 years
    Right. I think Win7 is the culprit.
  • Gerold Meisinger
    Gerold Meisinger almost 13 years
    this is most probably a permission issue or process locking the directory. got the same problem here at MacOSX
  • Dastur
    Dastur over 7 years
    Explorer won't display the .git folder and rmdir says that it isn't allowed because the folder isn't empty...