When running Emacs on Windows 10, I am able to launch git bash from within Emacs using the information given here, here, or here. For example, I can just add these two lines to my .emacs:

(setq explicit-shell-file-name "C:/Program Files/Git/git-bash.exe")
(setq explicit-bash.exe-args '("--login" "-i"))

Then, M-x shell opens a git bash.

However, git bash always opens in its own window, not as a buffer within Emacs. This is undesirable as it breaks my workflow within emacs. It also, apparently, isn't what usually happens, judging by the experience of other users.

Any ideas on how I can get git bash to open up within emacs? Thanks!

  • Check your sources again, they are not using the same file as you are.
    – npostavs
    Nov 28, 2017 at 2:53

1 Answer 1


I am using

(setq shell-file-name "C:\\Program Files\\Git\\bin\\bash.exe")

git-bash.exe does seem to want to open up an external window. bash.exe seems to start the git bash shell in the emacs window.

  • I recommend you use / instead of \\ in your filenames. It'll work just as well but without the pain of having to double them all.
    – Stefan
    Jan 28, 2018 at 14:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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