Skip to content

Instantly share code, notes, and snippets.

@Brottweiler
Last active February 24, 2024 21:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Brottweiler/acb1c6825a79b43df9f8bf264a36f0b8 to your computer and use it in GitHub Desktop.
Save Brottweiler/acb1c6825a79b43df9f8bf264a36f0b8 to your computer and use it in GitHub Desktop.
My way of using etckeeper

I have my dotfiles in a directory called ~/dotfiles in my home directory that is the repository. I move my files there, and remove the dot. Then I have a script to symlink them out. But etckeeper works differently...

With etckeeper, you would initialize the repo inside /etc, not a sub directory. This should be fine, but it creates complications because your gitignore needs to be a whitelist instead of a blacklist.

Using etckeeper

Pushing

The first thing that you should do, is create /etc/.gitignore. Etckeeper does this automatically, with some defaults, but you want a whitelist, not a blacklist, so add a single * in the file. This should prevent etckeeper from doing git add for all your files.

Now do # etckeeper init to initialize the repo.

Edit your .gitignore to include the files you want to track. You should write them as !pacman.conf for example.

From here, you should be able to add your remote, git add the files you want, then git push.

Pulling

But what about when you want to install your etckeeper that you made on another install? You can't clone into an existing dir, so you either have to clone to a new dir, then move the content over to /etc. But what about etckeeper? I don't know yet...

Work in progress.

Relevant info

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment