Conemu: can't attach new Git For Windows 2.0

Created on 5 Jun 2015  路  6Comments  路  Source: Maximus5/ConEmu

I'm running the new Windows Git 2.0 release candidate. It uses msys2 and mintty.

If I open git bash, and try to attach window it throws an error as attached. With the previous version of windows git, when I ran git bash, it automatically attached to conemu, a feature I'd like to re-enable.

I also installed msys2 stand alone and that does attach. Also when I open msys2, it always opens a cmd window that gets attached to conemu that just says press any key to close, not problematic though.
EDIT: actually, msys2 stopped attaching as well, not sure what changed.

conemubug

Most helpful comment

Preferred way to run git-for-windows is using git-cmd.exe

c:\git\git-cmd.exe --command=usr/bin/bash.exe -l -i

All 6 comments

In trouble shooting it I realized conemu and mintty are both terminals. So it was a bit redundant. Not sure if it should work that way or not. Though when WinGit2 replaces the current one, I'm sure many more people will run into this issue.

I'm not sure how git-bash.exe is launching it, but I just created a shortcut file that kind of matched that msys did when it fell bash to sh:

C:\Windows\System32\cmd.exe /A /C C:\msysGit\usr\bin\bash --login -i

and that seems to work fine. Don't know if there are any special env variables that are important to set, like MSYSTEM, MSYS, or anything else.

Oh, I also had to change in /etc/profile :

export TERM=cygwin

It was export TERM=xterm-256color but that had issues clearing the screen when opening nano. I tried TERM=linux and a couple others, but cygwin seemed to work cleanest.

Calling cmd.exe before bash is absolutely excessive. Look how ConEmu creates default tasks when you run ConEmu.exe -basic.

Also, there was an issue in git-for-windows
https://github.com/git-for-windows/git/issues/96#issuecomment-106048871

I'm able to successfully attach git-bash.exe from the Git 2.4.2.1 release candidate, by using the following task command in ConEmu (details originally found here and here):

"%ProgramFiles%\Git\git-bash.exe" --needs-console --no-hide --minimal-search-path --command=usr\\bin\\bash.exe --login -i -new_console:t:"Git Bash":C:"%ProgramFiles%\Git\mingw64\share\git\git-for-windows.ico"

The only quirk is that this actually creates 2 tabs... one for git-bash.exe, which is effectively hung for the duration, and a second for the console window which it creates. Thus far, I haven't found any way around the multiple tabs.

@Maximus5, is it possible to make ConEmu hide a tab (without showing the original, hidden console window)? If so, that would likely be a usable workaround.

I should have added that the following task command works, at least for the time being, without the multiple-tab side effect.

set MSYSTEM=MINGW64 & "%ProgramFiles%\Git\usr\bin\bash.exe" --login -i -new_console:t:"Git Bash":C:"%ProgramFiles%\Git\mingw64\share\git\git-for-windows.ico"

I'd prefer to avoid this approach, however, since git-bash.exe may perform additional setup which causes this method to break in future.

I haven't decided yet which behavior or switches would be correct for running git-bash.exe. This tool is compiled as GUI application but it starts console window, may be improperly. Perhaps I will create pull request for git-for-windows later.

Preferred way to run git-for-windows is using git-cmd.exe

c:\git\git-cmd.exe --command=usr/bin/bash.exe -l -i
Was this page helpful?
0 / 5 - 0 ratings

Related issues

imalos picture imalos  路  5Comments

altbdoor picture altbdoor  路  4Comments

eblis picture eblis  路  5Comments

DrMerlin picture DrMerlin  路  4Comments

pyhedgehog picture pyhedgehog  路  3Comments