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?


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

1 Answer 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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .