git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Windows git bash - child processes see system PATH environment variable instead of user...

From
EMEdward Marshall <marshallx7a@gmail.com>
Date
Feb 17, 2016, 21:31 UTC
Message-ID
<CAN2vHUFYqKDDEJpGtxJ9aD+8abe-krnHBy7cm1tMm0+bh5ykBQ@mail.gmail.com>

This happens on my Windows 7 Home Premium x64 SP1 Desktop, but not on my Windows 10 Pro x64 laptop.

Everything used to work fine until I updated my Desktop to the latest version of Git (the laptop has the same version but was a totally clean install as it is a new laptop)

Edward@Edward-PC MINGW64 /f/Work $ echo $PATH ...(USER PATH)...

Edward@Edward-PC MINGW64 /f/Work $ cmd Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

F:\Work>echo %PATH% echo %PATH% ...(SYSTEM PATH)...

The same is true of any child process (e.g. node.js) - they all see SYSTEM PATH now instead of USER PATH. I have tried clean reinstalling git. I have tried both the 64-bit and 32-bit versions of git.

Used Process Explorer to investigate the environment of the processes on the 2 machines. The only significant difference I can see is the PATH variable in cmd.exe.

If I double-click bash.exe (instead of the shortcut to git-bash.exe) then the user PATH is seen by child processes. Double clicking git-bash.exe, still has the problem. Running bash -l from a cmd window, has the problem.

Run bash.exe, then sh echo $PATH // Shows user path cmd echo %PATH% // Now shows system path So bash saw user path, sh saw user path but then cmd was passed the system path?!

Run bash.exe followed by cmd, cmd, cmd, etc - cmd always sees user path. So bash -l and sh both see user path but then only forward system path to child processes...

sh definitely used to work as well as the git bash shortcut (I know because I run git bash > grunt > sh and that now sees the wrong/incomplete path when before it was working fine)

I have spent most of this frustrating day trying to figure out what is going wrong but do not have a clue.

I have no .bashrc or .bash_profile files on either system (no idea what these are for but a colleague was trying to help diagnose the problem - they ultimately came up empty). As far as I can tell the 2 systems are set up exactly the same (apart from the different Windows versions of course). Path length is not an issue as the (working) laptop has a huge path whereas the (not working) desktop has less than 500 characters.

Unfortunately I don't know what version of git I had before, and older versions aren't offered for download so I can't trial and error. Really wishing I hadn't upgraded!

Any assistance would be much appreciated as I am totally pulling my hair out now.

Many thanks and kind regards,
Edward Marshall
Next: Johannes Schindelin
Message 1 of 4 in “Windows git bash - child processes see system PATH environment variable instead of user...”
  1. Edward MarshallFeb 17, 2016
  2. Johannes SchindelinFeb 19, 2016
  3. Edward MarshallFeb 19, 2016
  4. Johannes SchindelinFeb 19, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.