0

I need help to understand a workaround for my problem...I'm a beginner in GIT

BACKGROUND : I need to content manage the configurations files of a server in git, some of the directories have file with different user and groups

Assuming i need to content manage /etc/config. The files underneath config looks something similar to below

-rw-r--r--   1 www      www 658  Feb 17  2011 abc.txt
-rwxr-xr-x   1 exr      exr 496  May 28  2019 abc.sh
-rwxrwxrwx   1 stg      stg 6666 Apr  9  2020 xyz.sh

ISSUE: during git pull all of the username group & permissions gets changed to root since i'm running git pull as root OR if i sudo to any particular user and run a git pull then the files are owned by that particular user

how do i retain the files with same user and groups?

Please help

Charlie
  • 39
  • 1
  • 7
  • https://stackoverflow.com/questions/15076348/how-to-keep-git-from-changing-file-ownership – phd Jan 13 '21 at 11:56
  • https://serverfault.com/questions/133508/how-to-prevent-ssh-git-push-to-set-file-ownership – phd Jan 13 '21 at 11:56
  • Short resume: there is no simple way. But you can use a kind of meta-storage or a `post-update` hook. – phd Jan 13 '21 at 11:59
  • Thanks for quick turnaround. Is there a reference of such post-update files? Please share if there is one available – Charlie Jan 13 '21 at 12:25
  • https://gist.github.com/YaroslavShapoval/cbab1fe98adb14ddc2cf, https://www.generacodice.blog/es/articolo/1883968/how-to-control-ownership-of-files-auto-pushed-to-a-git-target-repo-by-commit-hooks, https://stackoverflow.com/a/17772912/7976758 Found in https://www.google.com/search?hl=en&pws=0&q=git+%22post-update%22+hook+ownership – phd Jan 13 '21 at 12:39

0 Answers0