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.
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.
Make sure the file is added to git repo, if not add the file in git repo and then try it will work.
fatal: Unable to mark file Localization/el-GR.js
What you can do is:
$git update-index --assume-unchanged <file name>
This helped me! :)
If your path has spaces, you may get this error even if you have the casing right.
This results in the "fatal" error:
git update-index --assume-unchanged code/Solution Files/WebEssentials-Settings-json
To fix it, simply add quotes around the path.
git update-index --assume-unchanged "code/Solution Files/WebEssentials-Settings-json"
My Problem was, that I tried the command with a * wildcard assuming it would be recursive, but it wasn't.
So what I did was
$ git reset HEAD
Unstaged changes after reset:
M .gradle/1.9/taskArtifacts/cache.properties.lock
M .gradle/1.9/taskArtifacts/fileHashes.bin
M .gradle/1.9/taskArtifacts/fileSnapshots.bin
M .gradle/1.9/taskArtifacts/outputFileStates.bin
M .gradle/1.9/taskArtifacts/taskArtifacts.bin
executing
$ git update-index --assume-unchanged .gradle/1.9/taskArtifacts/*
worked for me then and didn't result in OPs and my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With