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] ?
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).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With