1

I read this solution How do I make Git ignore file mode (chmod) changes? and tried a number of other things but the following keeps happening:

When I do

git status -v

It shows

diff --git a/video.html b/video.html
old mode 100644
new mode 100755

So it's picking up changes in file permissions, but when I run the following command to make it ignore file changes

git config core.filemode false

It still sees the changes. Am I doing something wrong or misunderstanding how filemode works?

I also tried changing global git settings, modifying the .git/config file etc to set filemode to false but nothing works, it still sees the changes.

Manual permission change via git update-index

The only workaround I found for now is by going to repo folder and doing something like git update-index --chmod=-x FILENAME with a recursive approach

git ls-files --stage | grep 100755 | cut -f2 | xargs git update-index --chmod=-x

But this does not cover all of the files unfortunately

"Solution"

In the end had to do a hard reset from master to fix the issue. Think the problem was that I committed that files with changed permissions BEFORE doing the git config core.filemode false and once committed I'm assuming it was somewhere in git cache and there was no way to ignore the permissions with any sort of filemode change.

Robert Sinclair
  • 4,550
  • 2
  • 44
  • 46
  • Post complete output. My `git status -v` does not show `diff --git ...`. Did you mean to run `git config core.filemode false` (note the `false`)? – j6t Jul 21 '21 at 15:04
  • @j6t yep, my mistake I ran the `git config core.filemode false` + variations of it to set it on a global level and also to changed it in `.git/config` etc. In terms of the output complete output from git status -v is over a thousand lines, but the `diff --git` is definitely from there – Robert Sinclair Jul 21 '21 at 17:07

1 Answers1

1

Update: the question is modified now; here's what I think the real answer is:

  • Your file system doesn't actually support modes.
  • You did actually set core.filemode to true at some point.
  • This made Git believe the results from the lstat call. That updated a bunch of index entries to have mode 100755 (probably).
  • This in turn had Git make a commit with the wrong modes in it.
  • After that, you fixed core.filemode (put it back to false) and perhaps updated Git's index as well (note that Git's index retains any +x or -x setting that gets set in it, whether that comes from trusting-lstat-and-seeing-x-bits-in-the-working-tree, or from git update-index --chmod, or whatever, until some other operation comes along and updates Git's index).

Once things get messy, the fix tends to be messy too.

Original answer below.


git config core.filemode means git config --get core.filemode, i.e., tell me what core.filemode is set to. It will not change the setting.

As noted in the accepted answer to the question you linked to, the command to set it is:

git config core.filemode false

(you can spell core.filemode with partial or full uppercase if you like; this particular bit of Git is case-insensitive). In general, however, you should never set core.filemode at all. Having to do so indicates that something else on your system is misbehaving. You should fix the other thing instead.

torek
  • 448,244
  • 59
  • 642
  • 775
  • hi, sorry it was a typo on my end, it's the command in the question title which i tried git config core.filemode false and variations such as setting in on a global level etc. – Robert Sinclair Jul 21 '21 at 17:04
  • 1
    @RobertSinclair: typos are one of the little devils (imps?) of programming and hence programming questions: it's usually a good idea to try the command and cut-and-paste both it and its output. :-) – torek Jul 21 '21 at 21:12
  • amen to that! sorry for the time wasted! – Robert Sinclair Jul 22 '21 at 02:48