I have a repository where some files should have 600 permissions. That is chmod 600 <file>, and even though umask 022, if I edit that file again and write it (e.g. via Emacs), the 600 permissions are preserved and not reset according to umask. That's correct behavior in my opinion or at least desired from my side.
Now, when I decide that those changes are bad and I want to discard them, I can issue git checkout -- <file>. However, in this case, Git somehow forces umask 022 on this file and permissions become 644. Why?
How can I get rid of this intrusive behavior? Is this editor (e.g. Emacs) being smart on preserving permissions or Git forcing umask 022 on me? git config --add core.sharedrepository 0077 also had no effect so far.