1

I have files in my git directory that have permission 600.

When I used git-pull in my computer and git-push in another computer, the permission changes to 664.

Is there a way to preserve permissions(600) after git-pull?

Thanks

2
  • 1
    AFAIK, git only track execute permissions on files. – Kusalananda Jan 5 '20 at 11:18
  • So how I can save the permissions when I use git ? – Eliya Jan 5 '20 at 12:02
1

As mentioned by @Kusalananda, git normally only tracks execute permissions. In order to save more permissions information, you would need to implement a pre-commit hook that would gather up the permissions info and store it separately, and another hook to restore permissions on pull.

etckeeper is basically a collection of tools that does this for the purpose of placing your /etc directory under version control. You might want to adapt it to your purposes, or perhaps study what it does to do something similar yourself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.