Problem using git and Emacs eshell mode on Windows
Asked Answered
S

5

6

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

git commit -a -m "message"

I receive an error:

'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?

Simba answered 17/6, 2009 at 11:10 Comment(2)
Might I also suggest Magit? zagadka.vm.bytemark.co.uk/magit/magit.htmlCastello
Have the same error on MacOS. Where do I add the path so eshell sees it?Alleyway
C
4

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 ...
Cardiganshire answered 17/6, 2009 at 11:58 Comment(1)
i've solved problem by reinstalling git into c:/git, so there are not spaces in the pathsSimba
A
4

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")
Alleyway answered 8/4, 2010 at 11:26 Comment(0)
T
2

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.

Troxler answered 17/6, 2009 at 13:24 Comment(1)
the error occurs somewhere inside git or emacs.eshell, so i can't manageSimba
A
1

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).

Alroy answered 17/6, 2009 at 13:4 Comment(0)
T
-2

Uh, eshell and git? Why?

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

Tank answered 17/6, 2009 at 14:22 Comment(2)
-1 Magit's interface doesn't support everything the command-line interface does. For instance, it doesn't support PGP signing commits, which makes it a non-starter for me.Varistor
Magit also allows you to run commands as you would on the command line, so you can do everything in Magit that you can on the command line with the git commandWrigley

© 2022 - 2024 — McMap. All rights reserved.