Git doesn't store file modes, it only stores the type of file (symlink, directory, executable, not executable) using something that looks suspiciously like unix file modes.
Storing something that is not one of these hardcoded bits, for example, 0777
would not be legal. This would be a corrupt tree object and git fsck
would complain about it.
(Note that there is a historical exclusion to this - 0664
is allowed in a tree, and is considered a warning instead of an error.)