1

I would like to have Git Bash inside Eclipse, similar to Windows cmd terminal. Right click on project - Show in Local Terminal - Git Bash. Now it opens in a new window. I have checked the options under Window - Preferences - Terminal - Local Terminal - Git Bash - Edit , but none works.

On another PC Git Bash opens inside Eclipse - see screenshot with this and the settings.

I would appreciate if you can help me to dock/attach Git Bash back into Eclipse.

Screenshot

Git Bash Eclipse

howlger
  • 31,050
  • 11
  • 59
  • 99
Michael
  • 25
  • 8
  • The screenshot shows the other PC, right? How does it look like on your PC? – howlger Aug 28 '20 at 13:35
  • Yes, indeed. On my PC it looks like second picture above. – Michael Aug 28 '20 at 14:33
  • Are you sure you have `sh.exe` and not `git-bash.exe`? Also `-i` for _interactive_ separated by a blank is important (do you get the same with `-i` as first argument?). If it is exactly the same on both PCs, look at the versions. – howlger Aug 28 '20 at 15:06
  • yes, it was git-bash.exe ; after I changed to sh.exe it works inside Eclipse. Thank you very much! – Michael Aug 28 '20 at 15:26

2 Answers2

0

Make sure to specify the path of sh.exe, not of git-bash.exe.

howlger
  • 31,050
  • 11
  • 59
  • 99
0

Similar to Adding Git-Bash to the new Windows Terminal what you need to use is point to %PROGRAMFILES%\git\usr\bin\bash.exe with the command line arguments of -i -l. Note that you need to expand to the full path as Eclipse does not support % expansion. What I do is to use the Browse... dialog and paste the path there and let Windows expand it for you.

The one you are using starts an MSYS console that in turn starts up a shim which in turn starts up the bash command above.

By going directly to %PROGRAMFILES%\git\usr\bin\bash.exe you save a few MB of memory and one entry in the Task Mananager.

In the following screenshot I am using the Scoop version, since that's what I have installed, but it should work with the standard installer.

enter image description here

Here's how it looks like. Note I set invert terminal colors on settings so that the background will be black otherwise my colors would be hard to read.

enter image description here

Archimedes Trajano
  • 35,625
  • 19
  • 175
  • 265
  • I tried that, but the git functionality is lost. When I choose git/bin/bash.exe it works. Thank you as well for the information. – Michael Aug 28 '20 at 16:00
  • Interesting that you lose the `git` functionality. I presume you passed in `-i -l` parameters too because that should've given you the functionality by reading the profile and setting the paths correctly. – Archimedes Trajano Aug 28 '20 at 16:07
  • I just tried it and it appears to work for me. Though I have to fix the paths a little bit because I am using Scoop rather than the traditional one. – Archimedes Trajano Aug 28 '20 at 16:22
  • 1
    I tried again and made sure -i -l is set up, but it still looses git somewhere on the way.. Maybe there is some other settings to be considered, but I am fine now that I have a solution. My git is in the AppData/Local... folder. – Michael Aug 28 '20 at 18:30