How to track server configs with Git
Version-control server configuration files under /etc using Git for change tracking and rollback.
How to track server configs with Git
Version-control server configuration files under /etc using Git for change tracking and rollback.
Prerequisites
- Git and root access on a Linux server.
Step-by-Step: Track Server Configs with Git
Initialize a Git repository in
/etc:cd /etc sudo git initCreate a
.gitignoreto exclude volatile files:sudo tee /etc/.gitignore << 'EOF' mtab adjtime ld.so.cache resolv.conf *.cache *.pid EOFAdd and commit the initial configuration state:
sudo git add -A sudo git commit -m "Initial commit of /etc configuration"After making configuration changes, commit them with a descriptive message:
sudo git add -A sudo git commit -m "Increase Nginx worker_connections to 4096"View the change history:
sudo git log --onelineRoll back a change by reverting a specific commit:
sudo git revert abc1234