Git Bash Here in ConEmu

69,083

Solution 1

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.

Solution 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

Solution 3

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.

Solution 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

Solution 5

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"
Share:
69,083
Charles Roper
Author by

Charles Roper

Digital Services Manager at Field Studies Council.

Updated on September 18, 2022

Comments

  • Charles Roper
    Charles Roper over 1 year

    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
    Charles Roper almost 12 years
    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?
  • Maximus
    Maximus almost 12 years
    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}
  • Charles Roper
    Charles Roper almost 12 years
    OK, I'm n 120727b and my Integration for Git Bash looks like this: i.imgur.com/XF8A8.png. This works, but the icon doesn't. What is supposed to happen? I still get the default ConEmu icon.
  • Maximus
    Maximus almost 12 years
    Where exactly icon do not works? i.imgur.com/mUWOF.png i.imgur.com/SRkDI.png i.imgur.com/UAqHh.png i.imgur.com/hY4bR.png All OK in my test
  • Charles Roper
    Charles Roper almost 12 years
    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: i.imgur.com/TRtVV.png and i.imgur.com/CcI58.png. I've tried with and without quotes. It seems to work in Win7 though.
  • Charles Roper
    Charles Roper almost 12 years
    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.
  • Maximus
    Maximus almost 12 years
    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
    Maximus almost 12 years
    I recommend to remove external quotes for ""c:\program.. -i" in task contents. Leave quotas for path only
  • Charles Roper
    Charles Roper almost 12 years
    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: i.imgur.com/pOc2U.png
  • Maximus
    Maximus almost 12 years
    Tab Icons are in plans
  • jcollum
    jcollum over 11 years
    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"
  • Eric Warnke
    Eric Warnke over 9 years
    This is an up-to-date method that worked for me today: blog.tyrsius.com/setting-up-conemu-with-git-bash-on-windows
  • Meredith
    Meredith about 9 years
    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.
  • Luca Vavassori
    Luca Vavassori over 8 years
    There is no integration under features anymore.
  • Charles Roper
    Charles Roper over 8 years
    @emrah I've updated the answer - thanks for the heads up!
  • Glenn Lawrence
    Glenn Lawrence almost 8 years
    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
  • Саша Черных
    Саша Черных about 7 years
    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.
  • Charles Roper
    Charles Roper about 7 years
    @СашаЧерных I don't know, I've never done that, sorry. Perhaps Maximus knows?
  • rolyat
    rolyat over 6 years
    This worked for me even without installing git using chocolatey
  • John Vandivier
    John Vandivier over 6 years
    Be sure to click "save settings" in the bottom-right after creating the new task or you will lose the task.
  • JW0914
    JW0914 about 6 years
    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.”
  • jpaugh
    jpaugh about 6 years
    Windows Subsystem for Linux (WSL). @JW0914 Good to know. Do you have a source for that quote?
  • JW0914
    JW0914 about 6 years
    @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.
  • Rivenfall
    Rivenfall almost 5 years
    Nice option to have: General -> single instance mode
  • Nathan Redblur
    Nathan Redblur almost 4 years
    That article was wrote 4 years ago, a lot a new change has made since that. But is not the case of this question ask if WSL is secure or note.