Search code examples
gitaccess-denied

Access is denied for git filter-branch


I am trying this solution: Can't push to GitHub because of large file which I already deleted

In an elevated cmd (and with Visual Studio closed) I am giving:

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <TheFolderIWantToDelete>' HEAD

or:

git filter-branch --index-filter 'git rm -r --cached --ignore-unmatch <TheFolderIWantToDelete>' -f HEAD

and in both cases I get the following error: Access is denied

What exactly is being denied access to? TheFolderIWantToDelete? And how can I find out what exactly denies the access?

The command result

UPDATE: I also take "Access is denied" when I specify a different existing directory. But when I specify a different non existing directory, I take "The system cannot find the file specified.". So something prevents access to TheFolderIWantToDelete.


Solution

  • This worked (with double quotes):

    git filter-branch --index-filter "git rm -r --cached --ignore-unmatch ProjectReleases" HEAD