twpayne / chezmoi

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

Chezmoi cd exits git bash in windows terminal #3832

Closed caseycronyn closed 4 months ago

caseycronyn commented 4 months ago

What exactly are you trying to do?

Execute 'chezmoi cd' and remain in bash in windows terminal

What have you tried so far?

Have tried the same thing in the git bash terminal. Here there's no problem

Where else have you checked for solutions?

Output of any commands you've tried with --verbose flag

$ chezmoi --verbose $COMMAND

Microsoft Windows [Version 10.0.22631.3737]
(c) Microsoft Corporation. All rights reserved.

C:\Users\<USER>\.local\share\chezmoi>

Output of chezmoi doctor

```console $ chezmoi doctor RESULT CHECK MESSAGE ok version v2.49.1, commit b4b55659c69fb13a502903c16dcdd566b988eece, built at 2024-06-23T12:28:09Z, built by goreleaser ok latest-version v2.49.1 ok os-arch windows/amd64 ok systeminfo Microsoft Windows 11 Pro (10.0.22631 N/A Build 22631) ok go-version go1.22.4 (gc) ok executable ~/AppData/Local/Microsoft/WinGet/Packages/twpayne.chezmoi_Microsoft.Winget.Source_8wekyb3d8bbwe/chezmoi.exe ok upgrade-method winget-upgrade ok config-file ~/.config/chezmoi/chezmoi.toml, last modified 2024-06-25T17:37:05+01: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 ok cd-command found C:/WINDOWS/system32/cmd.exe ok cd-args 'C:\\WINDOWS\\system32\\cmd.exe' info diff-command not set ok edit-command found C:/WINDOWS/system32/notepad.exe ok edit-args 'C:\\WINDOWS\\system32\\notepad.exe' ok git-command found C:/Program Files/Git/mingw64/bin/git.exe, version 2.45.2 ok merge-command found C:/Program Files/Git/usr/bin/vimdiff.exe ok shell-command found C:/WINDOWS/system32/cmd.exe ok shell-args 'C:\\WINDOWS\\system32\\cmd.exe' info age-command age not found in $PATH ok gpg-command found C:/Program Files/Git/usr/bin/gpg.exe, version 2.4.5 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 rbw-command rbw not found in $PATH info vault-command vault not found in $PATH info vlt-command vlt not found in $PATH info secret-command not set ```

Additional context

Add any other context about the problem here.

bradenhilton commented 4 months ago

Per https://www.chezmoi.io/reference/commands/cd/:

Launch a shell in the working tree (typically the source directory). chezmoi will launch the command set by the cd.command configuration variable with any extra arguments specified by cd.args. If this is not set, chezmoi will attempt to detect your shell and finally fall back to an OS-specific default.

Per your chezmoi doctor output:

...
ok       cd-command                  found C:/WINDOWS/system32/cmd.exe
ok       cd-args                     'C:\\WINDOWS\\system32\\cmd.exe'
...
ok       shell-command               found C:/WINDOWS/system32/cmd.exe
ok       shell-args                  'C:\\WINDOWS\\system32\\cmd.exe'
...
caseycronyn commented 4 months ago

Thanks so much for the timely and valued help on this, I've got it working.

Here's my chezmoi.json configuration file in case it helps anyone:

{
    "cd": {
        "command": "C:\\Program Files\\Git\\bin\\bash.exe"
    }
}