Git chmod problem: Checkout screws exec bit

Not a Git user, but I believe that Git stores the entire file permission mask.

That means that you have once set the file to executable, which Git picked up and replicated in the repository. Therefore you must change the file's permission mask itself before committing.

To make Git ignore such changes, use

git config core.filemode false

From git-config(1) :

   core.fileMode
       If false, the executable bit differences between the index and the
       working copy are ignored; useful on broken filesystems like FAT.
       See git-update-index(1). True by default.

Did you check whether there is a custom hook that is executed during commit or checkout? There might be some custom hooks tampering with your files. Checkout the githooks manpage.

Hooks are basically little programs called by git at certain events (commit, checkout etc.).


have you tried git commit -m 'mode is 644' file on branch dev-branch

to me it looks like what is happening is you are changing permissions on main then pulling down the dev branch that has the wrong permission, clobbering your local permission. then trying to commit again. either clone, change, commit, merge; or try changing the file individually with a single file commit into dev then merge