0

When trying to delete .git folder using del /s /a .git, I get this error

The tag present in the reparse point buffer is invalid.

and this rd -f /s /q .git results in this error

The system cannot find the file specified. .git\objects - The directory is not empty.

So, what is the right command to forcefully remove this folder?

Diaa
  • 167

2 Answers2

2

del only deletes files.

To delete folders, use one of the following:

rmdir /s /q .git

rd /s /q .git

That will delete the directory recursively without prompting.

Nasir Riley
  • 1,564
1

One of the subdirectories might be a special reparse point which allows a kernel driver to provide custom handling for the items inside, e.g. on Windows it is possibly the "VFSForGit" software which downloads objects as they're needed, instead of downloading the entire repository up-front.

Run fsutil reparsepoint query .git\objects to check if that is the case.

If you indeed have Git VFS installed, try using gvfs unmount to deactivate it. (Though in your case, it sounds like the driver is no longer installed; "invalid tag" means the OS doesn't know how to handle the specific subtype.)

In general, fsutil reparsepoint delete should be able to remove any reparse point.

grawity
  • 501,077