Why the file modes on OSX and Linux are different when cloning code with git
I cloned the same project from Github on my MacBook (Sierra) and Linux machine (Ubuntu 16.04), and I see the file mode on my MacBook is “-rw-r–r–“, but in my Linux machine, it is “-rw-rw–r–“.
Is there a way to make them consistent? Thanks!
One Solution collect form web for “Why the file modes on OSX and Linux are different when cloning code with git”
Git cares only about the executable bit. The rest is left to the system. Unix systems have a per-process
umask value, set and maintained by the
umask command, that says which permissions not to grant.
0077 are common settings for that. My Arch linux default is
0022, don’t grant write privilege to anyone but me. It looks like your linux distro defaults to
0002, don’t grant write privilege to the general public, but allow it for you and your group.
umask 0022 in your shell startup. If you want it system-wide, look in
/etc/profile, the Arch one runs any hooks in
/etc/profile.d so you could add an override there.