Closed anhdle14 closed 2 years ago
This error is coming from git, not chezmoi.
I suspect that you have a git-repo
external where the local working tree has been modified. When you run chezmoi apply
, chezmoi runs git pull --rebase
in the external's directory, which is then failing due to the local changes.
You can verify this by running
$ chezmoi apply --debug
which should show you exactly what is failing.
I'll open a PR to improve chezmoi's error message here.
This is a git message because you don’t have pull.autostash = true
(which, while a really good thing to do, can occasionally result in stashes that result in conflicts if you have enough changes) and have a dirty git index.
chezmoi git status
should provide useful information. as to what the modified files are. If you don’t care, you can force the pull with chezmoi git pull -- --autostash --rebase
.
@twpayne Do we want to use --autostash
by default or have a chezmoi configuration that would apply that? I never see this, because I have pull.autostash = true
in my .gitconfig
, and it’s safe ~99.9% of the time (that last 0.1%, though, can result in some really fun merge collision resolutions).
Ah, thanks for the tip on --autostash
@halostatue. Yes, I think it makes sense to have autostash as the default. A user can override it by setting pull.args
for the repo in their .chezmoiexternal.<format>
.
Hopefully this issue is now resolved. Please re-open if necessary.
What exactly are you trying to do?
chezmoi apply
failed. with error:What have you tried so far?
Also tried to use
git pull
both directly or viachezmoi
:chezmoi cd
->git pull --rebase
chezmoi update
->chezmoi git pull -- --rebase && chezmoi diff
All returns nothing wrong.
Describe what you have tried so far.
Where else have you checked for solutions?
Output of any commands you've tried with
--verbose
flagOutput of
chezmoi doctor
Additional context
Add any other context about the problem here.