ワンクリックで
chezmoi-secrets-management
Integrate with password managers (Bitwarden, 1Password, etc.) and manage encrypted files using age or gpg.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Integrate with password managers (Bitwarden, 1Password, etc.) and manage encrypted files using age or gpg.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Write chezmoi templates: OS/machine conditionals, user-defined data variables, Sprig functions, shared fragments, and interactive prompts.
Run scripts on apply, once, or on content change — manage run_, run_once_, run_onchange_, run_before_, and run_after_ scripts and their state.
Configure chezmoi behavior: source/target dirs, data injection, encryption, editor, diff/merge tools, git auto-commit, and operation hooks.
Bootstrap chezmoi on a new machine, clone an existing dotfiles repo, migrate existing dotfiles, or run one-shot init scripts.
Work with the chezmoi source directory: file naming prefixes, adding/removing files, externals (.chezmoiexternal for external files, archives, and git repos), special directories (.chezmoiignore, .chezmoitemplates/), and git operations.
Look up and run chezmoi commands: add, apply, diff, status, update, verify, edit, merge, re-add, state, and other core operations on the target directory.
| name | chezmoi-secrets-management |
| description | Integrate with password managers (Bitwarden, 1Password, etc.) and manage encrypted files using age or gpg. |
When you need detailed examples, full lists of template functions for password managers, or external documentation links, scan the references/ directory.
chezmoi supports two strategies for secrets in dotfiles:
Use template functions for secrets that may rotate. Use encrypted files for static credentials or keys you want in-repo.
| Function | Signature |
|---|---|
onepasswordRead | onepasswordRead url [account] |
onepassword | onepassword uuid [vault [account]] |
onepasswordDetailsFields | onepasswordDetailsFields uuid [vault [account]] |
onepasswordDocument | onepasswordDocument uuid [vault [account]] |
{{ onepasswordRead "op://vault/item/field" }}
{{ (onepassword "$UUID").fields }}
{{ (onepasswordDetailsFields "$UUID").password.value }}
{{- onepasswordDocument "$UUID" -}}
onepassword and onepasswordDetailsFields return structured data parsed from op JSON output, not plain strings.
Requires the op CLI; chezmoi prompts to sign in if there is no valid session.
{{ (bitwarden "item" "$ITEMID").login.password }}
{{ (bitwardenFields "item" "$ITEMID").token.value }}
{{- bitwardenAttachment "$FILENAME" "$ITEMID" -}}
bitwarden and bitwardenFields pass their arguments to bw get unchanged and parse the JSON output; bitwardenFields indexes the fields array by field name.
Requires bw CLI and the BW_SESSION env var, or set bitwarden.unlock = "auto" in config to run bw unlock --raw automatically.
{{ pass "path/to/secret" }}
{{ (passFields "path/to/secret").password }}
{{ gopass "path/to/secret" }}
pass and gopass return only the first line of output; passRaw and gopassRaw return the full output.
{{ (keepassxc "Entry Name").Password }}
{{ keepassxcAttribute "Entry Name" "attribute" }}
{{- keepassxcAttachment "Entry Name" "filename" -}}
Requires keepassxc-cli and keepassxc.database set in config.
{{ keyring "service" "user" }}
Set values with:
chezmoi secret keyring set --service=$SERVICE --user=$USER
{{ (vault "$KEY").data.data.password }}
vault takes a single key, passes it to vault kv get -format=json $KEY, and returns the parsed JSON.
[secret]
command = "vault"
{{ secret "arg" }}
{{ secretJSON "kv" "get" "-format=json" "$ID" }}
secret returns raw command output with whitespace trimmed; secretJSON parses the output as JSON.
# chezmoi.toml
encryption = "age"
[age]
identity = "~/.config/chezmoi/key.txt"
recipient = "age1..."
encryption must be set at the top level before any section; use identities/recipients (plural, lists) for multiple keys.
Generate a key (chezmoi age-keygen works without age installed):
chezmoi age-keygen --output ~/.config/chezmoi/key.txt
chezmoi add --encrypt ~/.ssh/id_ed25519
chezmoi stores the file as private_dot_ssh/encrypted_private_id_ed25519.age in the source (encrypted_ applies to files only, never directories).
The identity file must be present and readable.
# chezmoi.toml
encryption = "gpg"
[gpg]
recipient = "user@example.com"
symmetric = false
chezmoi add --encrypt ~/.netrc
[gpg]
symmetric = true
chezmoi prompts for a passphrase on add and apply.
Encrypted files in the source dir are named with the encrypted_ prefix:
encrypted_dot_netrc.age → ~/.netrcprivate_dot_ssh/encrypted_private_id_ed25519.age → ~/.ssh/id_ed25519The .age or .asc extension is stripped at apply time.
You can use password manager functions directly in chezmoi.toml.tmpl:
[data]
gitSigningKey = {{ onepasswordRead "op://vault/GPG Key/public key" | quote }}