I have a project in which I have to change the mode of files with chmod to 777 while developing, but which should not change in the main repo.
Git pick
If you want to set this option for all of your repos, use the --global option.
git config --global core.filemode false
If this does not work you are probably using a newer version of git so try the --add option.
git config --add --global core.filemode false
If you run it without the --global option and your working directory is not a repo, you'll get
error: could not lock config file .git/config: No such file or directory