Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've recently added a directory to the Windows PATH manually by going into Control Panel -> System -> Advanced system settings -> Environment Variables -> User variables -> PATH. (Windows 7, 64-bit.)

After rebooting and starting cmd.exe, echo %PATH% indicates that this worked: I see the directory I recently added in the output.

However, after starting Git Bash, the output of echo $PATH doesn't include this directory.

I could add export PATH=$PATH:/c/my/path in my bashrc but I'd rather Git Bash just get PATH from Windows so I don't have to remember to add paths to two places. How can this be accomplished?

(A more general related question is, what sets up Git Bash's $PATH? I see a couple of entries repeated in different places, some things that are in Windows %PATH% are in Git Bash's $PATH but not others. What all happens before I get the Git Bash prompt that touches $PATH?)

share|improve this question

migrated from Jun 14 '13 at 7:24

This question came from our site for professional and enthusiast programmers.

The path in question might be important: C:\cygwin\usr\x86_64-w64-mingw32\sys-root\mingw\bin. – Ahmed Fasih Jun 13 '13 at 17:34
If you could ... be a sport eh? Mark the answer that VonC gave being correct if it answered your question :-) – Eddie B Sep 6 '13 at 5:17
up vote 3 down vote accepted

An msysgit git bash session uses the script share/WinGit/Git Bash.vbs, which doesn't access or modify the environment variable PATH (like it would in this unrelated vbs script, for instance)

A git bash session will simply add in front of your current PATH:


It is possible that the mingw session packaged with msysgit won't consider a bin from another mingw installation: you can check it by setting another (simpler) directory to your PATH and see if it is still visible in your git bash session. If not, then it is a more general issue which concerns all directories that you would add to the PATH.

share|improve this answer

Try moving the directory to the beginning of your path variable. I had the same issue as you after installing p4merge. The perforce directory was added to the path and p4merge was found by cmd.exe, but not git shell (mingw). After a fruitless search, I tried just editing the variable so that the perforce directory appeared first in my path. I fired up git shell and, voila, the directory is included in the output of $ echo $path, and $ p4merge opens up p4merge.

This is kind of a lame answer, since I'm clueless as to why it works, but if the work-around helps someone else, great.

share|improve this answer

If the PATH value would be too long after your user's PATH variable has been concatenated onto the environment PATH variable, Windows will silently fail to concatenate the user PATH variable.

This can easily happen after new software is installed and adds something to PATH, thereby breaking existing installed software. Windows fail!

The best fix is to edit one of the PATH variables in the Control Panel and remove entries you don't need. Then open a new CMD window and see if all entries are shown in "echo %PATH%".

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.