Are file permissions and owner:group properties included in git commits? How are these properties of files and directories handled throughout the git pipeline [commit, push, pull, merge, etc] ?
3 Answers
Files in Git are assigned either 644 (owner rw-
, group and other r--
) or 755 (owner rwx
, group and other r-x
). Ownership information is not stored.
This is deliberate, and well-explained by this post by Git's maintainer, Junio Hamano:
Actually in a very early days, git used to record the full (mode & 0777) for blobs.
Once people started using git, everybody realized that it had a very unpleasant side effect that the resulting tree depended on user's umasks, because one person records a blob with mode 664 and the next person who modifies the file would record with mode 644, and it made it very hard to keep track of meaningful changes to the source code. This issue was fixed long time ago with commit e447947 (Be much more liberal about the file mode bits., 2005-04-16).

- 127,765
- 105
- 273
- 257
Generally, no. These are all things that are local to particular machine environment.
The exception is that Git uses permission-like settings to track a few "universal" attributes, like whether a file is executable and if an object is file or a submodule. Git can, where possible, map these to your local environment on checkout.

- 497,756
- 71
- 530
- 681
In Windows, no, but *nix will push changes in permissions. I've had problems where Windows see changes in *nix permissions and isn't quite sure what to do with it.

- 1,443
- 1
- 8
- 8