3

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
  • 2
    AFAIK, git only track execute permissions on files. Commented Jan 5, 2020 at 11:18
  • 1
    So how I can save the permissions when I use git ? Commented Jan 5, 2020 at 12:02

1 Answer 1

4

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.