Etckeeper lets you keep
/etc under version control.
Install the package.
The preferred version control system (default is git) and other options are to be configured in
Etckeeper supports using pacman as a
After configuration the repository for the
/etc path has to be initialized:
# etckeeper init
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
There is a
cron script in the source distribution.
You can use this script to automatically commit changes on a schedule.
For example, to make it run daily:
- Have cron installed and enabled.
- Put script as
- Permit execution of file for root (
# chmod u+x /etc/cron.daily/script_name).
To automatically create commits on every file modification inside
/etc/, use . It utilizes native filesystem signalling through .
Automatic push to remote repo
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.
etc/.git and add your remote Github repository:
# git remote add origin https://github.com/user/repo.git
Next, a hook must be used or configured to push.
Using etckeeper provided hook
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
#!/bin/sh set -e if [ "$VCS" = git ] && [ -d .git ]; then cd /etc/ git push origin master fi
Now each time you run your wrapper script or alias from above, changes will be automatically commited to your Github repo.
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:
#!/bin/bash etckeeper pre-install command 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.