From ArchWiki
Jump to: navigation, search

Etckeeper lets you keep /etc under version control.


Install the etckeeper package.


The preferred version control system (default is git) and other options are to be configured in /etc/etckeeper/etckeeper.conf.

Etckeeper supports using pacman as a LOWLEVEL_PACKAGE_MANAGER and HIGHLEVEL_PACKAGE_MANAGER in etckeeper.conf.


After configuration the repository for the /etc path has to be initialized:

# etckeeper init

As of etckeeper version 1.18.3-1, pre-install and post-install pacman hooks are executed automatically on package installation, update and removal. A manual #Wrapper script is not required anymore.

To track other changes to the /etc path, you need to either commit changes manually (see the etckeeper(8) man page for commands) or use one of the stopgap solutions below.


Service and timer units are included in the package. Simply enable etckeeper.timer.

See Systemd/Timers for more information and Systemd#Editing provided units if you wish to edit the provided units.


There is a cron script in the source distribution at debian/cron.daily. You can use this script to automatically commit changes on a schedule. To make it run daily, for example, make sure you have cron installed and enabled, then simply copy the script from the srcdir where you built etckeeper to /etc/cron.daily and make sure it is executable (e.g. chmod +x /path/to/script).


Tango-view-fullscreen.pngThis article or section needs expansion.Tango-view-fullscreen.png

Reason: Please expand this section with instructions on how to set up incron or link to a write-up. (Discuss in Talk:Etckeeper#)

As an alternative to the above, you could set up incron to automatically commit changes using etckeeper whenever a file in /etc is modified.

Automatic push to remote repo

Warning: Pushing your etckeeper repository to a publicly accessible remote repository can expose sensitive data such as password hashes or private keys. Proceed with caution.

Whilst having a local backup in /etc/.git is a good first step, etckeeper can automatically push your changes on each commit to a remote repository such as Github.

First, edit etc/.git and add your remote Github repository:

# git remote add origin

Next, a hook must be used or configured to push.

Using etckeeper provided hook

Edit the PUSH_REMOTE option in /etc/etckeeper/etckeeper.conf, with the name of the remote repository you want etckeeper to push to. For example:


Multiple remote repositories can be added separated with spaces.

Through a custom hook

Create an executable file /etc/etckeeper/commit.d/40github-push:

set -e

if [ "$VCS" = git ] && [ -d .git ]; then
  cd /etc/
  git push origin master

Now each time you run your wrapper script or alias from above, changes will be automatically commited to your Github repo.

Wrapper script

If you want to track changes of a frequently executed command (e.g. command), a simple wrapper script can help to automate it. For example, create:


etckeeper pre-install
etckeeper post-install

and make it executable. Alternatively, you may call the Etckeeper commands via a bash alias or function, see Bash#Aliases for more information.

Note: Before Etckeeper version 1.18.3-1 such manual wrapper script was required for Pacman integration. Now the Pacman hooks perform the commands automatically.