Skip to content

add/re-add on external_ files #4992

@SafetyMary

Description

@SafetyMary

What exactly are you trying to do?

Following instructions from the docs (https://www.chezmoi.io/user-guide/include-files-from-elsewhere/#use-git-submodules-in-your-source-directory). I have set up git submodule managed directory, prefixed by external_ to prevent incompetible file names in the submodule.

However when i run chezmoi re-add on edited files (files edited directly without running chezmoi edit due to it being a lock file, lazy-lock.json from LazyVim specificially) it created a new file in .local/shared/chezmoi/ without the external_ prefix, forcing me to manually handle the config changes rather than running the chezmoi re-add workflow. I wonder if there is any naive way in chezmoi to handle this.

What have you tried so far?

I have also tried to find if there are any appropreate flags for chezmoi re-add and chezmoi add that i can use but found none suitable for my case.

Where else have you checked for solutions?

Output of chezmoi doctor

Details
$ chezmoi doctor
RESULT    CHECK                       MESSAGE
warning   version                     v2.70.0, built by build.opensuse.org
ok        latest-version              v2.70.0
ok        os-arch                     linux/amd64 (openSUSE Tumbleweed)
ok        uname                       Linux localhost.localdomain 6.19.10-1-default #1 SMP PREEMPT_DYNAMIC Wed Mar 25 11:02:57 UTC 2026 (a439317) x86_64 x86_64 x86_64 GNU/Linux
ok        go-version                  go1.25.8 (gc)
ok        executable                  /usr/bin/chezmoi
ok        config-file                 found ~/.config/chezmoi/chezmoi.toml, last modified 2026-03-30T16:48:55+08:00
ok        source-dir                  ~/.local/share/chezmoi is a git working tree (clean)
ok        suspicious-entries          no suspicious entries
ok        working-tree                ~/.local/share/chezmoi is a git working tree (clean)
ok        dest-dir                    ~ is a directory
error     hardlink                    failed creating hardlink from ~/.local/share/chezmoi to /tmp: link ~/.local/share/chezmoi/.chezmoi-doctor-hardlink-test /tmp/chezmoi-doctor2135625695/.chezmoi-doctor-hardlink-test: invalid cross-device link
ok        symlink                     created symlink from .new-name to .old-name
ok        umask                       022
ok        cd-command                  found /usr/bin/fish
ok        cd-args                     /usr/bin/fish
info      diff-command                not set
ok        edit-command                found /usr/bin/nvim
ok        edit-args                   /usr/bin/nvim
ok        git-command                 found /usr/bin/git, version 2.53.0
ok        merge-command               found /usr/bin/vimdiff
ok        shell-command               found /usr/bin/fish
ok        shell-args                  /usr/bin/fish
info      age-command                 age not found in $PATH
ok        gpg-command                 found /usr/bin/gpg, version 2.5.18
info      pinentry-command            not set
info      1password-command           op not found in $PATH
info      bitwarden-command           bw not found in $PATH
info      bitwarden-secrets-command   bws not found in $PATH
info      dashlane-command            dcli not found in $PATH
info      doppler-command             doppler not found in $PATH
info      gopass-command              gopass not found in $PATH
info      keepassxc-command           keepassxc-cli not found in $PATH
info      keepassxc-db                not set
info      keeper-command              keeper not found in $PATH
info      lastpass-command            lpass not found in $PATH
info      pass-command                pass not found in $PATH
info      passhole-command            ph not found in $PATH
info      protonpass-command          pass-cli not found in $PATH
info      rbw-command                 rbw not found in $PATH
info      vault-command               vault not found in $PATH
info      secret-command              not set

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportSupport request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions