Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?


1 Answers

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.

like image 131
twalberg Avatar answered Nov 10 '25 11:11

twalberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!