twpayne / chezmoi

Manage your dotfiles across multiple diverse machines, securely.
https://www.chezmoi.io/
MIT License
13.39k stars 493 forks source link

Understanding encryption configuration #2433

Closed Allaman closed 2 years ago

Allaman commented 2 years ago

What exactly are you trying to do?

Setup chezmoi with age encryption but unclear how to handle chezmoi.toml

What have you tried so far?

Now I am struggling with how to handle chezmoi.toml? On a new machine without that config file chezmoi will not work when running chezmoi apply. Adding the config to the repository is also not working because chezmoi asks for encryption data before applying the config.

Also how do I edit the encrypted secret? When running chezmoi edit it opens my Neovim's netrw and when I open the encrypted gitconfig it is still encrypted. My assumption was that chezmoi edit would decrypt files?

twpayne commented 2 years ago

Use a config file template to create a config file on a new machine automatically. You'll need to copy your age identity file manually.

chezmoi edit does transparently decrypt files for editing and re-encrypt them when you exit your editor. If it's not working as expected you can use the --debug flag to see exactly how chezmoi invokes your editor.

Allaman commented 2 years ago

Thanks @twpayne for your reply

I completely overlooked this part of the documentation...

I missunderstood chezmoi edit in this case. After carefully reading the docs again i noticed that the docs state chezmoi edit $FILE. Using this command decrypts the file. I am used to open my whole dotfiles repo at once so I did not think of specifying a file name explicitly and just ran chezmoi editwithout arguments