Understand chezmoi’s files and directories
chezmoi generates your dotfiles for your local machine by combining two main sources of data: Source directory (~/.local/share/chezmoi)
- Common to all your machines
- A clone of your dotfiles repo
- Each managed file has a corresponding source file here
~/.config/chezmoi/chezmoi.toml)
- Specific to the local machine
- Can also use JSON or YAML format
- Contains machine-specific variables
Use a hosted repo to manage your dotfiles across multiple machines
chezmoi uses version control to share changes across machines. You should create a repo on your preferred platform (GitHub, GitLab, Bitbucket) to store your dotfiles.Use a private repo to store your dotfiles
chezmoi supports both public and private repos. For security:- Store secrets in password managers or encrypted files
- Keep private data in machine-specific config files
- Your dotfiles repo can remain public
When using a private GitHub repo without SSH, you’ll need to use a GitHub personal access token instead of your password.
Create a config file on a new machine automatically
Automate config file creation by adding a.chezmoi.toml.tmpl template to your repo:
chezmoi init, this template will generate your chezmoi.toml config file. The promptStringOnce function prompts for values not already set.