git update-index --assume-unchanged returns "fatal unable to mark file"

I was having the same issue on a Mac. Case-sensitivity wasn't an issue for me - the problem was I needed to reset my git first:

Problem:

 git update-index --assume-unchanged index.php
 fatal: Unable to mark file index.php

Solution:

git reset HEAD
Unstaged changes after reset:
M   index.php
git update-index --assume-unchanged index.php

In my case the tree I was marking was a directory, and not a file as in you case, and I was missing the forward slash after its name.

Incorrect -

git update-index --assume-unchanged directory-name

Correct -

git update-index --assume-unchanged directory-name/

Note the forward slash(/) in the end.


I was having the same problem as you, and had followed the same four steps that you indicated above, and had the same results. This included the fact that my file was listed when executing git ls-files -o. However in my case, I also tried executing git update-index --assume-unchanged against a file that was not listed when executing ls-files -o, and I still received the same error "fatal: Unable to mark file".

I thought that perhaps it was a bug, and downloaded the latest version of git, but this did not help.

What I finally realized is that this command is case sensitive! This includes the full path and file name. After updating path to the directory so that the full path was specified with proper casing, the command executed properly.

Note that this was with Git for Windows, so you're results may vary with other platforms.

Tags:

Git