Ubuntu – Creating a Git repo at / (root) for tracking settings

gitrootsettings

So I use Git mostly for development purposes, but I just realized that I could use it for storing versions of the settings files I have on my Ubuntu installation.

My proposed setup is:

  • git init a repo at /

  • Add a .gitignore at / that ignores any files except specific settings I want to track.

    For example, the .gitignore could contain (source):

    ## Ignore everything...
    *
    
    ## Except...
    !/etc/default/tlp
    !/etc/crontab
    
  • Whenever I change these low-level settings, I can track them.

Is there anything that could go wrong with this setup? Does the kernel always need / to only have certain folders? Will it mess up the functioning of any applications?

Best Answer

The answer to both of your questions is no, you can create any directory you want in the /. the only thing that could happen is some permission issues with some spacial paths I guess.

However it's better to store the .git directory somewhere else, something look like:

git --git-dir=/home/user/backup-root --work-tree=/

Read here.