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!

  • restoring a repository from a .git folder
  • git add Signed-off-by line using format.signoff not working
  • How to restore Git bare repository from local one
  • GIT command working in GIT bash but not from Jenkins
  • Git checkout with dot
  • How do I see the diff of a merge commit in IntelliJ IDEA?
  • How to download all possible maven dependencies so they are local
  • Git, Tower, and SourceTree
  • git wildcard - remove all instances of a subdirectory
  • Git cloning a repository that is already a clone
  • Clone a locally mounted repository
  • Is there any way to get the SHA of a commit from its message?
  • 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. 0022 and 0066 and 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.

    So put 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.

    Git Baby is a git and github fan, let's start git clone.