Apr 30, 2014

Using git versioning to keep track of your UNIX settings in `/etc/`

Simple idea: Using git's versioning and remote capabilities to keep track of your settings in /etc/. Why?

The following steps require root privileges.

First we need to init a git repository:

  $ cd /ect/
  $ git init .

Optional: add a .gitgnore to exclude specific and temporarily files and folders:


# temporary files which can be created if a process still has a handle open of a deleted file

# KDE directory preferences

# Linux trash folder which might appear on any partition or disk

We add all files and create a first commit:

  $ git add --all .
  $ git commit -am "initial commit"

Chronological commits

An easy way to ensure that we add regular commits is to create a cronjob with:

  $ crontab -e
  0 6 * * * cd /etc/ && git add --all . && git commit -am "automatic commit on $(date)"

Remote backups

Remote backups can easily be done by git push --all origin master.

Further tools

If you prefer additional software tools helping you, try out etckeeper (thank to Pedro for the hint).