Have chezmoi create a directory, but ignore its contents
For directories like~/src where you want the directory created but not its contents managed:
chezmoi automatically creates
.keep files when you add an empty directory with chezmoi add.Ensure that a target is removed
Create a.chezmoiremove file in the source directory with patterns of files to remove:
Manage part, but not all, of a file
chezmoi provides two approaches for managing partial file contents:- modify_ scripts
- Modify templates
- Template re-generation
A
modify_ script receives the current file content on stdin and outputs the modified content:If the file doesn’t exist, stdin will be empty and the script must write a complete file to stdout.
Manage a file’s permissions, but not its contents
Use thecreate_ attribute to manage permissions without changing file contents:
- Using create_ attribute
- Using run_ script
Create an empty file with the desired attributes:chezmoi will apply permission changes from
private_, executable_, and readonly_ attributes without modifying contents.This approach creates the file if it doesn’t exist.
Handle configuration files which are externally modified
Some programs modify their own config files. To track these changes, use symlinks:Create a symlink to the source file
private_ prefix is used because ~/.config and ~/.config/Code are private by default.Populate ~/.ssh/authorized_keys with your public SSH keys from GitHub
chezmoi can retrieve public SSH keys from GitHub:
~/.local/share/chezmoi/dot_ssh/authorized_keys.tmpl
~/.ssh/authorized_keys with all public keys from your GitHub account.