mise does not operate well under GitBash on Windows #3961
Replies: 5 comments 20 replies
-
Beta Was this translation helpful? Give feedback.
-
|
State as of
|
Beta Was this translation helpful? Give feedback.
-
|
For anyone having trouble setting up msys2/git bash, here's my current workaround script (works with eval "$(mise activate bash | sed 's|eval "$(mise hook-env -s bash)";|& export PATH="$(/usr/bin/cygpath -u -p "$PATH")";|')"All it does is manually patching the offending |
Beta Was this translation helpful? Give feedback.
-
|
See my gist for Windows 11, Git BASH, The recommendation from @Trung0246 set me on a path toward a solution but did not fix it. |
Beta Was this translation helpful? Give feedback.
-
|
I'm currently using these post-activation hacks for cygwin bash: export __MISE_ORIG_PATH="$(cygpath -wp "$PATH")"
declare -gA mise_path_cache
_mise_hook() {
local previous_exit_status=$?
eval "$(command mise hook-env -s bash)";
PATH=${mise_path_cache["$PATH"]="$(/bin/cygpath -p "$PATH")"}
return $previous_exit_status;
};This seems to keep both mise and bash relatively happy. The cache part is there because otherwise there's an extra process start (for the cygpath) on every prompt, adding noticeable lag. (I also had to write the activation script to a file and replace all the windows paths to mise.exe, much like in the above examples and gists.) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
As a user of GitBash (which comes with Git for Windows), I installed the 2025.1.0 Windows-x64 (ef6936a 2025-01-01).
The program works fine, but it produces paths that are incompatible with GitBash. Any command that updates the PATH variable (including
eval $(mise activate bash)) corrupts the GitBash terminal session, rendering it unusable because GitBash cannot find any commands anymore due to the corrupted PATH variable.The problem:
mise outputs paths in Windows format:
C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\binusing theC:prefix, the\directory separator, and the;path separator. However, GitBash expects paths to be in Linux format: using/c/prefix,/directory separator, and:path separator.One element of solution:
When running under GitBash ($OSTYPE == "msys"), paths generated by mise should be in Linux format using the
/and:separators. In addition, paths pointing to directories inside the GitBash installation directory should be without theC:\Program Files\Gitprefix, so that they are seen as absolute paths inside the Linux VFS. For example,C:\Program Files\Git\mingw64\bin=>/mingw64/bin,C:\Program Files\Git\usr\bin=>/usr/bin.Beta Was this translation helpful? Give feedback.
All reactions