I am trying to ignore the changes made to .gitignore file. For achieving this I am using this command git update-index --assume-unchanged bin/.gitignore
on git bash.
When I execute, I see Unable to mark file bin/.gitignore
response on my git bash.
How to solve this and why am I facing this problem?
I tried this link too but didn't help
git update-index --assume-unchanged returns "fatal unable to mark file"
after talking in comments and getting more information, I am posting this as an answer.
Very likely the cause is, the file you want to set assume-unchanged
bit was not tracked by git. In comment, I mention the command:
git ls-files --error-unmatch /yourPath/file
Which you can check if a file is tracked by git.
If it is not tracked, you cannot update the index, since it is not indexed yet. You can just add it to your .gitignore
file, so that it will be ignored by git.
Make sure your file's relative path is correct.
Try this:
$ pwd # see working directory
$ ls -la ./bin/ # see if .gitignore file exist!
$ git update-index --assume-unchanged ./bin/.gitignore
And also see if your bin/.gitignore
file is listed in git ls-files -o
.
$ git ls-files -o # Show other (i.e. untracked) files in the output
If .gitignore
file is found then add
, commit
. Then try undate-index
.
$ git add .
$ git commit -m 'Message'
$ git update-index --assume-unchanged ./bin/.gitignore
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