Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git bash is adding its current path to one of the parameter

Tags:

git-bash

I am using Git bash in windows to run a .sh shell script. This script takes some arguments. One of those arguments is a path as shown below:

Test test --path /ROOT/phani123 --comment testing

When I debug the path argument through my Javacode it actually looks like C:/Program Files/Git/ROOT/phani123. Git bash is prepending its location to the path I've passed.

How to stop Git bash doing this?

like image 822
Phani Avatar asked Nov 17 '25 03:11

Phani


2 Answers

You need to set the following environment variable to disable this:

export MSYS_NO_PATHCONV=1

See https://stackoverflow.com/a/34386471/8261

like image 109
Rich Avatar answered Nov 20 '25 05:11

Rich


Shamelessly copied from the other thread with an MSYS focus, for clarity here: (Go and give the answer a +1)

In summary, to disable this Posix path convesion:

  • For MSYS2 (built-in): MSYS2_ARG_CONV_EXCL="*"
  • For Git for Windows (built-in): MSYS_NO_PATHCONV=1
  • For MinGW.org (with msys-core-extended): MSYS_NO_PATHCONV=1.
like image 44
spechter Avatar answered Nov 20 '25 05:11

spechter