linux – How to manage file versions with git if files are owned by root and non-root users?


I have root owned files and other files in a directory and I would like to use git for version control of these files. Is it possible to use same git repo for files owned by root and non-root users or is it just asking for troubles?

I made a simple test where I created a repo as ordinary user, checked in and out some files and the checked in root owned files by using sudo git add, sudo git commit because ordinary user does not have read access to these files.
After this .git/index is owned by root and ordinary user cannot run e.g. git add, git commit.

What is the recommended way to manage versions if files are owned by root and non-root users?