Etckeeper

From the etckeeper website:
 * etckeeper is Article description::a collection of tools to let be stored in a git, mercurial, bazaar, or darcs repository. This lets you use git to review or revert changes that were made to . Or even push the repository elsewhere for backups or cherry-picking configuration changes.
 * It hooks into package managers like apt to automatically commit changes made to during package upgrades. It tracks file metadata that git does not normally support, but that is important for, such as the permissions of.
 * It's quite modular and configurable, while also being simple to use if you understand the basics of working with version control.

Emerge
Install

Additional software
etckeeper supports the following version control systems:
 * git

Files
The main configuration file is. Following configuration options in the main configuration file need specific settings:

Cron
The cron job is enabled by default, to disable it, uncomment following configuration entry:

systemd
To enable the systemd timer, run:

Usage
First, it must be considered if sensitive files (such as private keys) shall be included in the repository. If there are concerns, it is suggested to create a file before running the etckeeper initialization. This example below shows how to save explicit files to the etckeeper repository. The first entry  in the ignores ALL files in the /etc directory, following   negated entries mark the interesting files that will be saved to the repository. Only following files will be saved in the repository,  ,.

Initialization of the repository is done by running:

When initialization is done throught command, the author of the commit will be set to the corresponding user:

The command creates a file in the  directory. If it already exist, then a "managed by etckeeper" comment block is added. It also sets up pre-commit hooks. This command does not yet commit files, but runs to ensure all interesting files are included in the initial commit later.

When specific files shall be excluded, effectiveness of the  file can be verified by running. In the following example it is tested whether shadow files will be checked in. If any files that shall be excluded show up as a new file, then the is not applied properly and needs fixing.

If not interesting files show up, it is suggested to undo the etckeeper initialization (as described later in the Removal section), fix the and start again.

Finally commit all changes in to the repository. A commit message can be specified. It is possible to use the underlying VCS to commit manually. Note that commit will notice if a user has used  or  to become root, and record the original username in the commit. At this time it is recommended to use the command.

If the initial version has been commited, from this time forward it is safe to use following command below to commit diffs:

or:

Pack git repository to save disk space:

Troubleshooting
(Troubleshoot issues in this section. Separate issues by best describing the error with a new section name. Remove if no issues are known.)

Removal
Following commands deletes the directory:

Uninstall etckeeper:

External resources

 * README