Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want make version control for config files in Ubuntu server.

But I found out it's not easy for simply "git" whole etc folder, because so many file doesn't need to track and some time system will write some files like logs should ignore.

Is there an application can do that and make it easy? If it based on git that is better.

share|improve this question
    
Hey You can see following Question Link [configuration files in source control][1] [How can I version control server configuration files that are changed at application runtime, using git][2] [1]: stackoverflow.com/q/6009/1081776 [2]: serverfault.com/q/421207/124695 –  Arvind Gangwar Apr 8 '13 at 8:02

2 Answers 2

up vote 7 down vote accepted

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 Install 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

share|improve this answer
    
Thanks, it's better than what I want. –  emj365 Apr 9 '13 at 6:42

Below is a link to the same topic that might be useful:

http://tech.snathan.org/tech/svn/using_subversion_to_version_control_etc

It has a script at the end to automate most of the tasks for accomplish this.

share|improve this answer
    
Welcome to Ask Ubuntu! Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference. –  Eric Carvalho Jul 6 '13 at 15:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.