Git Bash Here in ConEmu

120

76

How do I create a right-click context menu entry to open Git Bash at a given folder within ConEmu? See Git Bash Here in Console2 for the equivalent question for Console2.

Charles Roper

Posted 2012-07-27T14:07:21.907

Reputation: 9 646

Answers

162

There are a number of ways this can be done in ConEmu as it is so highly configurable, but here's the way I do it.

  • In ConEmu, hit WinAltp to open the settings dialog.
  • Select the Tasks subsection under the Startup node and click the + icon to add a new 'Task'
  • In the Task Name field enter Git Bash, leave Task Parameters blank and add "C:\Program Files\Git\bin\sh.exe" --login -i to the Commands section. It should look something like this:

Git Bash task

  • Now select the Integration node and enter the following under the ConEmu Here - Explorer menu integration section:
    • Menu item: ConEmu Here [Git Bash]
    • Command: /single /cmd {Git Bash}
    • Icon file: C:\Program Files\Git\mingw64\share\git\git-for-windows.ico
  • Click the Register button

Integration

This should add an entry in your right-click context menu (complete with icon). In the Command field you can use any of the ConEmu.exe switches (worth checking out for more complete documentation of what you can do - it's pretty powerful).

Note: If you'd like a Git for Windows icon to appear at the top left of the ConEmu window, use the /icon switch; e.g.,

/icon "C:\Program Files\Git\mingw64\share\git\git-for-windows.ico" /single /cmd {Git Bash}

This only seems to work if it's the first tab open, though.

Charles Roper

Posted 2012-07-27T14:07:21.907

Reputation: 9 646

This is an up-to-date method that worked for me today: http://blog.tyrsius.com/setting-up-conemu-with-git-bash-on-windows/

– Eric Warnke – 2015-01-28T05:50:26.957

There is no integration under features anymore. – atilkan – 2015-12-04T22:26:49.197

1@emrah I've updated the answer - thanks for the heads up! – Charles Roper – 2015-12-04T23:04:10.213

2I just did this for ConEmu version 160909 and it worked like a charm. I note however that in this later version there is already a task called {Bash::Git bash} and its default command, that you don't need to change, is "%ConEmuDir%\..\Git\git-cmd.exe" --no-cd --command=usr/bin/bash.exe -l -i – Glenn Lawrence – 2016-06-14T08:11:41.337

CharlesRoper, which command I need use for {Far} mode? For example, I use /Single -run {Far}, but ConEmu open for me in C:\Program Files\Far Manager folder, not in a current folder. Thanks. – Саша Черных – 2017-02-26T11:44:50.393

@СашаЧерных I don't know, I've never done that, sorry. Perhaps Maximus knows? – Charles Roper – 2017-02-26T20:25:34.770

Be sure to click "save settings" in the bottom-right after creating the new task or you will lose the task. – John Vandivier – 2018-01-06T17:37:44.130

Nice option to have: General -> single instance mode – Rivenfall – 2019-07-24T11:07:41.400

Heh, I didn't know about that Integration settings page. Is it possible to support switches in that integration page? I tried adding switches to the task parameters but couldn't get that working. I can't get icons working at all. How would you get ConEmu to recognise the git.ico file? – Charles Roper – 2012-07-27T15:45:46.417

For example, I tried putting /icon "cmd.exe" in task parameters but the icon remains as the ConEmu one. – Charles Roper – 2012-07-27T15:47:02.403

OK, Download build 120727b or later. Goto "Integration" page. In the group "ConEmu Here" you may create any shell menu items and use conemu.exe switches in the "Command" field. For example /icon "cmd.exe" /cmd {Git Bash} – Maximus – 2012-07-28T02:55:28.847

OK, I'm n 120727b and my Integration for Git Bash looks like this: http://i.imgur.com/XF8A8.png. This works, but the icon doesn't. What is supposed to happen? I still get the default ConEmu icon.

– Charles Roper – 2012-07-28T21:01:57.573

Where exactly icon do not works? http://i.imgur.com/mUWOF.png http://i.imgur.com/SRkDI.png http://i.imgur.com/UAqHh.png http://i.imgur.com/hY4bR.png All OK in my test

– Maximus – 2012-07-28T23:56:15.113

I've got the icons in the top-left of the ConEmu window working (I think that may have been a cache issue - they just started working after a few restarts of Explorer and ConEmu). The icon that appears in the context menu still doesn't work in XP. Example: http://i.imgur.com/TRtVV.png and http://i.imgur.com/CcI58.png. I've tried with and without quotes. It seems to work in Win7 though.

– Charles Roper – 2012-07-30T13:13:19.597

I found out why the icon in the top-left of the app wasn't working. When /single is used and the app is already open, the existing icon is always used. A custom icon is only used if ConEmu is already closed. – Charles Roper – 2012-07-30T13:40:32.200

Icons in XP are possible only with menu handlers. Have no desire to go so deep for old OS. As for icon in Window title - it set up on ConEmu startup, of course, and not changed in "run time". – Maximus – 2012-07-30T14:33:42.350

I recommend to remove external quotes for ""c:\program.. -i" in task contents. Leave quotas for path only – Maximus – 2012-07-30T14:39:04.107

Is it possible to tie the icon to the current tab? And perhaps display the icon on the tab itself? This is what Console2 does and it's a nice touch. Example: http://i.imgur.com/pOc2U.png

– Charles Roper – 2012-07-30T15:21:36.070

Tab Icons are in plans – Maximus – 2012-07-30T16:58:53.503

5Installed Git Bash today and had to use this to get it to work with ConEmu: C:\Windows\SysWOW64\cmd.exe /c ""C:\Program Files (x86)\Git\bin\sh.exe" --login -i" – jcollum – 2013-01-03T21:30:26.237

4

I installed git using chocolatey and had the issue that git bash was not shown

I just had to click on "Add default tasks..." in Startup/Tasks to get {Bash::Git bash}

Add default tasks... in ConEmu

koppor

Posted 2012-07-27T14:07:21.907

Reputation: 327

This worked for me even without installing git using chocolatey – rolyat – 2017-11-06T18:41:17.360

4

Starting with ConEmu Portable .7z downoad and msysgit PortableGit .7z download, I created the following Windows shortcut. Of course adjust your portable path to ConEmu and Git appropriately.

LNK Target:

D:\PortableApps\ConEmu\ConEmu.exe /cmd bin\bash.exe --login -i -cur_console:n

LNK Start in:

D:\PortableApps\Git-msysgit

Git Bash Conemu lnk

Robert Collier

Posted 2012-07-27T14:07:21.907

Reputation: 679

4

I got Portable ConEmu version 150111 in zip archive and had the GiT Bash in tasks just out of the box. As well as some other entries. So there was no need in editing anything at all.

Puterdo Borato

Posted 2012-07-27T14:07:21.907

Reputation: 141

I just tried out the latest version of ConEmu portable, and needed to check the box that makes Git bash the default task run on a new shell. – Meredith – 2015-03-11T18:13:29.883

1

For Git GUI, use the same steps as outlined by Robert Collier, but use the following as the command:

"C:\Program Files (x86)\Git\bin\wish.exe" "C:\Program Files (x86)\Git\libexec\git-core\git-gui"

Aleksandr Dubinsky

Posted 2012-07-27T14:07:21.907

Reputation: 479

0

For the new Bash on Ubuntu on Windows the way to add it to conemu is create a new task like previous answers but add this fields

name: bash::ubuntu
icon: /icon "%USERPROFILE%\AppData\Local\lxss\bash.ico"
task: "%SYSTEMROOT%\System32\bash.exe" ~

I have on issue and always on close say that one process is running but I think that is because I have zsh inside bash console.

Nathan Redblur

Posted 2012-07-27T14:07:21.907

Reputation: 101

It's really not recommended to utilize WSL, as numerous security researches have highlighted exploitable flaws with WSL, and while convenient for some users who are not running Windows 10 Pro (Hyper-V), VirtualBox, or other type 2 hypervisor, it makes Windows less secure in doing so. As one researcher put it: "There are a number of ways Windows applications could inject code, modify memory & add new threats to a Linux application running on Windows... Attackers don’t usually go after the latest things... But as the feature adoption grows, this might become a more attractive attack vector.” – JW0914 – 2018-02-04T16:19:54.677

Windows Subsystem for Linux (WSL). @JW0914 Good to know. Do you have a source for that quote? – jpaugh – 2018-02-05T15:09:39.223

@jpaugh Security Reseacher explains security issues related to Windows 10 Linux subsystem at Blackhat.

While I understand why WSL appeals to users, they would likely be better served by either running a Linux distro within VirtualBox (if they don't have Windows 10 Pro), or if that's not feasible due to lower hardware specs, utilize an old laptop or an SBC, like SolidRun's CuBox-i, to exclusively run BSD/Linux on.

– JW0914 – 2018-02-05T21:56:09.073