Problem using git and Emacs eshell mode on Windows

when i try to make a git commit in emacs eshell mode:

git commit -a -m "message"

I receive an error:

  • How to make magit pull to have rebase option by default?
  • git commit with emacs as editor under Windows
  • How can I tell Emacs my git branch has changed?
  • How can I get Emacs to revert all unchanged buffers when switching branches in git?
  • How to re-evaluate shell environment and re-evaluate frame-title-format before opening each buffer in emacs
  • Subversion Branch in Mode-Line
  • 'c:\Program' is not recognized as an internal or external command,
    operable program or batch file.  

    and at the same time this problem is absent in emacs shell mode.
    How to force eshell work correctly with git?

  • Automatically versioning Android project from git describe with Android Studio/Gradle
  • How does one change the language of the command line interface of Git?
  • Why doesn't git amend warn you when there's nothing to amend?
  • Mac Terminal Commands - how to come back after forgetting to close quotation marks
  • Can I use git or another versioning system to private repository on http hosting acount without ssh?
  • git push to different branches on multiple remotes
  • 5 Solutions collect form web for “Problem using git and Emacs eshell mode on Windows”

    This seems to be a problem with the whitespace in the directory name of the program you want to execute; this whitespace seems to be not properly escaped.

    For example, if what you want to execute is “C:\Program Files\git\git.exe commit …”, then that first whitespace needs to be escaped, or the whole pathname enclosed in quotes, otherwise this line will be parsed into the tokens “C:\Program”, “Files\git\git.exe”, “…”, the first token being the command to execute.

    A first workaround would be to expand the full name by hand and enclose it in quotes, e.g.:

    "C:\Program Files\git\git.exe" commit ...

    Had a similar problem, this is for magit, (on MacOS). Add the following in your emacs startup file:

    (add-to-list 'exec-path "/usr/local/git/bin")
    (setq magit-git-executable "/usr/local/git/bin/git")

    Don’t know about specifically with git and emacs, but with other applications it has worked for me to replace Program Files with Progra~1 in your PATH.

    I had the very same problem, and “solved” it by changing PATH such that git.exe (in c:\Program Files\Git\bin) comes before git.cmd (in c:\program files\git\cmd, IIRC).

    Uh, eshell and git? Why?

    Just use magit for invoking git from emacs; it is much richer than the command-line interface.

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