git
itself does not provide ownership and privileges information, besides executable bit information. The solution for you is to use etckeeper
data.
Looking into the documentation, we have:
Most VCS, including git, mercurial and bazaar have only limited tracking of file metadata, being able to track the executable bit, but not other permissions or owner info. (darcs doesn't even track executable bits.) So file metadata is stored separately. Among other chores, etckeeper init sets up a pre-commit hook that stores metadata about file owners and permissions into a /etc/.etckeeper file. This metadata is stored in version control along with everything else, and can be applied if the repo should need to be checked back out.
So, the ownership of your directories are kept in /etc/.etckeeper
, which is monitored by git
as well. ;)
etckeeper commit
should solve your problem.
Depending on your scale, I would think about more complex and useful configuration management tools like Salt, Ansible, Puppet, Chef and so on.
etckeeper commit
.etckeeper commit
it might tell me that there isnothing to commit
, but thenetckeeper vcs status
tells me that now the metadata file.etckeeper
has been modified, so a subsequent run ofetckeeper commit
actually does find something in need of committing. Whenever I need to regenerate the metadata file, I prefer to runetckeeper pre-commit
because it is less confusing.