sh.exe”: emacs: command not found (Git bash Windows)

I’m using Git Bash on Windows 7 and have a problem with setting up emacs as the default text editor – I’ve tried git config --global core.editor emacs, then git config --global core.editor "'C:/emacs-23.3/bin/runemacs.exe'", git config --global core.editor emacsclientw but to no avail. Each time I enter something like ’emacs README.txt’ in Bash, the below error shows:

sh.exe”: emacs: command not found

  • How to write a shell script that checks if git repository is up to date?
  • /mingw32/libexec/git-core/git-sh-setup: 30: Syntax error: word unexpected (expecting “)”)
  • Can not recognize java command when using git bash
  • git hook bash does not work
  • Python Git Bash CMD Script
  • How do I exclude files from git ls-files?
  • I’ve put up with this for the longest time, choosing to just open up emacs separately and opening up the related file, but this time I really want to set things up properly so that I can save time and simply invoke emacs from Git Bash. Does anyone know what I can do? Thanks in advance for your help.

  • Strange error in gitlab: fatal: protocol error: bad line length character: Depl
  • Recommended workflow for multiple modules (themes)
  • Using multiple ssh keys for same host, without using an alias
  • Jenkins bitbucket integration
  • Use git command inside another git command
  • Is it possible to have a git repo inside another git repo
  • 2 Solutions collect form web for “sh.exe”: emacs: command not found (Git bash Windows)”

    You need to ensure the emacs bin directory is on the PATH so that the binary can be found when just entering emacs or emacsclient. You can set the default editor for most unix type tool to use your current emacs session by setting the environment variable EDITOR to emacsclient. You should use emacsclient rather than emacsclientw because you need the launching tool to wait for the edit to be completed and they do that by waiting for the editor to exit. If you only want git to use this then git config --global core.editor emacsclient would do the job, or setting GIT_EDITOR=emacsclient in the environment.

    In summary:

    export PATH EDITOR

    or fix the equivalents in the Windows system environment.

    You can also try the magit, which is amazing to use Git in emacs.
    You can get it from

    Git Baby is a git and github fan, let's start git clone.