Inherit environment variables when using bash.exe in the SDK?

119 views
Skip to first unread message

Carolyn Van Slyck

unread,
Jul 9, 2016, 2:07:34 AM7/9/16
to git-for-windows
I am used to how Git for Windows works, e.g. when I start C:\Program Files\Git\bin\bash.exe, existing environment variables such as PATH are made available in the subsequent bash session.

However the Git for Windows SDK (which I am using so that I have access to make) doesn't appear to have a nice wrapper bash.exe, just /usr/bin/bash.exe. I would like to either mimic what that wrapper executable does when using /usr/bin/bash.exe, or understand if it's safe to just copy the bash.exe wrapper from the Git for Windows installation directory into the SDK install directory?

I am currently calling bash like this:

c:\git-sdk-64\usr\bin\bash.exe --login -i -c "echo $PATH"

Any suggestions or pointers would be very much appreciated! :-)

Johannes Schindelin

unread,
Jul 9, 2016, 2:29:22 AM7/9/16
to Carolyn Van Slyck, git-for-windows
Hi Carolyn,

On Fri, 8 Jul 2016, Carolyn Van Slyck wrote:

> I am used to how Git for Windows works, e.g. when I start C:\Program
> Files\Git\bin\bash.exe, existing environment variables such as PATH are
> made available in the subsequent bash session.
>
> However the Git for Windows SDK (which I am using so that I have access
> to make) doesn't appear to have a nice wrapper bash.exe, just
> /usr/bin/bash.exe. I would like to either mimic what that wrapper
> executable does when using /usr/bin/bash.exe, or understand if it's safe
> to just copy the bash.exe wrapper from the Git for Windows installation
> directory into the SDK install directory?

It is safe to copy that file. FWIW it is the simple wrapper (posing as
bash.exe) built from Git's compat/win32/git-wrapper.c, and it is available
in the SDK at /mingw64/share/git/compat-bash.exe, from where it is copied
when building the installer.

Ciao,
Johannes

Carolyn Van Slyck

unread,
Jul 9, 2016, 5:27:17 PM7/9/16
to git-for-windows, m...@carolynvanslyck.com
Oh even better! I didn't realize that the wrapper was distributed with the SDK. :-) Thank you, Johannes for your help.

Carolyn
Reply all
Reply to author
Forward
0 new messages