116

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.

157

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.

  • 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 Jul 27 '12 at 15:45
  • For example, I tried putting /icon "cmd.exe" in task parameters but the icon remains as the ConEmu one. – Charles Roper Jul 27 '12 at 15:47
  • 5
    Installed 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 Jan 3 '13 at 21:30
  • 1
    @emrah I've updated the answer - thanks for the heads up! – Charles Roper Dec 4 '15 at 23:04
  • 2
    I 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 Jun 14 '16 at 8:11
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.

  • 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 Mar 11 '15 at 18:13
3

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

2

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

  • This worked for me even without installing git using chocolatey – rolyat Nov 6 '17 at 18:41
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"
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.

  • 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 Feb 4 '18 at 16:19
  • Windows Subsystem for Linux (WSL). @JW0914 Good to know. Do you have a source for that quote? – jpaugh Feb 5 '18 at 15:09
  • @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 Feb 5 '18 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.