Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bash doesn't see my PATH

People also ask

How do I show the path in git bash?

Click on Advanced System Settings. Click on Environment Variables. Under System Variables, look for the path variable and click edit. Add the path to git's bin and cmd at the end of the string like this: ;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd.

How do I see my path in git?

2 Answers. Git executable can be found by using running git --exec-path, which usually lives in the Git execution path. git --exec-path will give you the path.

Is git bash exe on the System path?

Git executable files are located in the C:\Program Files\Git\bin\git.exe and C:\Program Files\Git\cmd . These directories must be added to the PATH environment variable to run the program.


Got it. As a Windows user, I'm used to type executable names without extensions. In my case, I wanted to execute a file called cup.bat. In a Windows shell, typing cup would be enough. Bash doesn't work this way, it wants the full name. Typing cup.bat solved the problem. (I wasn't able to run the file though, since apparently bash couldn't understand its contents)

One more reason to switch to posh-git..

Thanks @Tom for pointing me to the right direction.


Maybe bash doesn't see your Windows path. Type env|grep PATH in bash to confirm what path it sees.


Following @Daniel's comment and thanks to @Tom's answer, I found out that Git bash was indeed using the PATH but not the latest paths I recently installed. To work around this problem, I added a file in my home (windows) directory named:

.bashrc

and the content as follow:

PATH=$PATH:/c/Go/bin

because I was installing Go and this path contained the executable go.exe Now Git bash was able to recognize the command:

go

Perhaps just a system reboot would have been enough in my case, but I'm happy that this solution work in any case.


While you are installing Git, you can select the option shown below, it'll help you to set the path automatically.

Git installation wizard

Its worked out for me :)


Create a file in C:\Users\USERNAME which is called config.bashrc, containing:

PATH=$PATH:/c/Program\ Files\ \(x86\)/Application\ with\ space

Now move the file on the command line to the correct location:

mv config.bashrc .bashrc