Windows is saying access denied to files I own

Use the takeown command from a administrative command line. It is possible to remove Full Access permissions to the Administrators group, if that happens the GUI version can't change permissions but the command-line command can still do it.

takeown /f C:\dev\nvg510controls\.git /r /d Y

if you want to be extra fancy you can set the permissions via the command line too

icacls C:\dev\nvg510controls\.git /t /grant Everyone:(F)

If neither of those commands work download PsExec and do the command

psexec -i -s icacls C:\dev\nvg510controls\.git /t /grant Everyone:(F) 

that will run icacls as the SYSTEM user instead of the Administrator user.


I don't know if that's going to help anyone out but I'll note here that I've just had a problem with Git not having permission to access files and tried the answer above with no success.

The problem turned out to be that, on a fairly new server, an enterprise virus checker saw a lot of activity in the .git directory from the Git process, marked Git as a suspicious process and stopped allowing it to access any files.