The package etckeeper
is specifically intended to manage your configuration files (located in the /etc
directory) under a version control system(VCS).
What is etckeeper?
etckeeper is a collection of tools to let /etc be stored in a git, mercurial, darcs, or bzr repository. It hooks into apt (and other package managers) to automatically commit changes made to /etc during package upgrades.
How do I install etckeeper?
To install the package, click on the link provided below to install in Ubuntu Software Center(USC), or run sudo apt-get install etckeeper
from the terminal(Ctrl-Alt-t).
etckeeper
How do I change etckeeper from the default VCS(bzr) to use git
?
By default, etckeeper
uses Bazaar(bzr) for version control management. This can be changed in the configuration file /etc/etckeeper/etckeeper.conf
.
First, you will need to have git installed.
sudo apt-get install git
sudo apt-get install git-core
Now, you will need to edit your etckeeper.conf
file to change your VCS. Here is what the first five lines of the default configuration should look like:
# The VCS to use.
# VCS="hg"
# VCS="git"
VCS="bzr"
# VCS="darcs"
This is the place in the configuration file to switch from using the default option of using bzr to using a git repository. Open a text editor (i.e. gksu gedit /etc/etc/keeper/etckeeper.conf
) and change the file to look like this:
# The VCS to use.
# VCS="hg"
VCS="git"
# VCS="bzr"
# VCS="darcs"
Uncomment the line VCS="git"
and comment out the line VCS="bzr"
Now, run sudo etckeeper init
to initialize your repository.
As mentioned here:
This sets up version control for all files in /etc
. You don't need to do anything else to manage etckeeper; you only need to interact with it when you want to do a version control operation, such as referring to older files. Files are automatically committed before and after each run of apt and every night (this is configurable).
Additional information on etckeeper:
See Ubuntu etckeeper documentation
also
Using etckeeper with git on Ubuntu
configuration files in source control
How can I version control server configuration files that are changed at application runtime, using git
– Arvind Gangwar Apr 08 '13 at 08:02