1

I have a local git repository which is upstream from another local git repository. When I pull from the upstream repository to the downstream one, I want the Windows file permissions on a particular file to be preserved after the update. I attempted using the following solution: https://github.com/git/git/blob/master/contrib/hooks/setgitperms.perl#L78

But I believe it is based on a UNIX security model and does not preserve my permissions. How can I accomplish this? I was considering using a python script with the win32security module (since I'm not familiar with perl), but have been unable to find suitable documentation for it. I have very little experience with Windows security beyond manually setting permissions.

Sws750
  • 33
  • 3
  • What is your primary question? If it is just "How can I accomplish this?" then that is too broad since there are countless ways. – Patrick Parker Aug 09 '18 at 17:40
  • @PatrickParker Actually I think this is just fine. "How can I do this?" type questions are not *inherently* too broad, only when they're like "How do I program a Facebook clone?". This question has a clear and *specific* problem. – Ajean Aug 09 '18 at 17:50
  • Possibly. Either way the question needs to be clarified to show more clearly what is the primary thing being asked. – Patrick Parker Aug 10 '18 at 08:33

2 Answers2

0

You can set your git config to ignore file permissions differences with

git config --global core.fileMode false

Worth giving it a try I guess.

Romain Valeri
  • 19,645
  • 3
  • 36
  • 61
0

The solution ended up being quite simple. I just had to set post-checkout and -merge hooks that ran a python script to set up the file permissions. I gleaned enough about win32security from here to work with it and made use of os.getcwd() (which is set to the git repo root while the hook is running) to locate the correct file.

Sws750
  • 33
  • 3