gitdirectoryfile-permissionsdirectory-permissions

How do I preserve DIRECTORY file mode or permission in git?


We have a remote git repo and some time we create directories with permission 777 but when others pull from the remote repo and checkout, directory permission isn't 777. How can I preserve directory permission in git?


Solution

  • git does not track permissions on files (only a single flag for executable/not executable), and does not track directories at all. If you really need to propagate permissions, you can add a short script to your repository that will set appropriate permissions, or research git add-on tools that essentially do this for you by capturing file metadata and re-implementing it on the remote end.