Linux – Version-control of configuration files with different home names

configurationgitlinuxversion control

I have recently decided to use a version-control system to share my configuration files between my different linux installs.

After reading another thread I found on this subject, I'm planning to do it using git.

I would put my / under revision control with a top-level .gitignore set to * and add manually each configuration file I want to keep track of (mainly files from /etc/…).

What I don't get though, is how I can handle different home directories. As an example, say on machine A I have /home/foo/.vimrc and on machine B /home/bar/.vimrc, how could I get git to keep both files under the same version control repository?

[Update]

I am looking for a very lightweight solution that does just what I need to (no Puppet or Cfengine for example). I was thinking about creating a .config folder in my /home/whatever/ in which I would keep all my important configuration files using a git repository. A very simple script would then create the needed symbolic links from my /etc/, ~/… and so on. Any other suggestions?

Best Answer

Arguably, you're trying to use a revision control system to do configuration management. Those are two very different kinds of activities. I think the approach you're taking won't scale well at all, and will lead to significant amounts of frustration. You would be better served to find decide upon a configuration management solution (there's quite a few well matured options out there: cfengine, puppet, chef, etc), and then have your configuration management solution pull its recipes and/or configuration files from the revision control system. It will give you the same net effect that you seem to be looking for, but will have the right tools working on the appropriate parts of the problem.