Manually setup a git repo in /etc
or take a look at the etckeeper
package. Don’t use a public repository, /etc can expose sensitive data such as password hashes or private keys.
apt get install etckeeper git incrontab
nano /etc/etckeeper/etckeeper.conf
, set VCS="git"
(comment the other options) and set PUSH_REMOTE="origin"
.
# Go to the configuration directory.
cd /etc
# Initialize etckeeper.
etckeeper init
# Add the remote repository.
git remote add origin git@HOSTNAME:REPONAME
# First commit.
etckeeper commit "Initial commit."
# Set the upstream and push.
git push -u origin master
exit
You can use https and username:password@HOSTNAME/REPONAME.GIT
while adding origin to automatically do things on behalf on that user.
Now, let’s tell incrotab
to trigger an automatic commit on every created, modificed or deleted folder or file in /etc :
# Edit incrotab jobs
incrontab -e
# Add this line
/etc IN_MODIFY,IN_CREATE,IN_DELETE,IN_MOVED_TO etckeeper commit "incrontab trigger"