Skip to content

PATH gets mangled when using direnv from git-bash on Windows #253

@irontoby

Description

@irontoby

Hello,

Installing the official git release for Windows will also install the git-bash.exe shell. Rather than an emulation layer, I believe this is bash plus lots of the standard Linux tools which have been compiled directly for Windows (it seems to be based off the Mingw-w64 project).

Within this shell, it mounts the Windows C: drive as /c and converts all the Windows paths to their Bash equivalents. For example my PATH right now looks something like this:

/c/Users/tobyj/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/b
in:/usr/bin:/c/ProgramData/Oracle/Java/javapath:/c/Windows/system32:/c/
Windows:/c/Windows/System32/Wbem:/c/Program Files/MariaDB 10.1/bin:/c/P
rogram Files (x86)/Yarn/bin:/usr/bin/vendor_perl:/usr/bin/core_perl

I downloaded the Windows version of direnv (direnv.windows-amd64.exe) and put it in a folder in my path. Then I added eval "$(direnv hook bash)" to my .bashrc. However when I create an .envrc and try either PATH_add node_modules/.bin or export PATH=$PWD/node_modules/.bin:$PATH, it appears that direnv is converting my $PATH to use Windows-style paths instead:

C:\devs\myproj\node_modules\.bin;C:\Users\tobias.johnson\bin;C:\Progr
am Files\Git\mingw64\bin;

Is there a way to get the Windows .exe to use Bash-style paths and not try to convert them? Or is there a config setting I need to change to get this behavior?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions