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
Capistrano deploy on windows fails with git Non-Terminating Process Git Bash (C#) hooks/post-receive: Syntax error: “(” unexpected (expecting “done”) Why does `git diff` not work with process substitution? Bash Script to Push/Pull from Private Git Repository? Meta-alias in Git Bash
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.
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
emacsclient. You can set the default editor for most unix type tool to use your current emacs session by setting the environment variable
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.
PATH=c:\emacs-23.3\bin;%PATH% EDITOR=emacsclient 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 https://github.com/magit/magit