Skip to content

add target...

Add targets to the source state. If any target is already in the source state, then its source state is replaced with its current state in the destination directory.


Encrypt files using the defined encryption method.

-f, --force

Add targets, even if doing so would cause a source template to be overwritten.


If the last part of a target is a symlink, add the target of the symlink instead of the symlink itself.


Set the exact attribute on added directories.

-i, --include types

Only add entries of type types.

-p, --prompt

Interactively prompt before adding each file.

-q, --quiet

Suppress warnings about adding ignored entries.

-r, --recursive

Recursively add all files, directories, and symlinks.

-T, --template

Set the template attribute on added files and symlinks.

When adding symlink to an absolute path in the source directory or destination directory, create a symlink template with .chezmoi.sourceDir or .chezmoi.homeDir. This is useful for creating portable absolute symlinks.


chezmoi add will fail if the entry being added is in a directory implicitly created by an external. See this GitHub issue for details.


$ chezmoi add ~/.bashrc
$ chezmoi add ~/.gitconfig --template
$ chezmoi add ~/.ssh/id_rsa --encrypt
$ chezmoi add ~/.vim --recursive
$ chezmoi add ~/.oh-my-zsh --exact --recursive