Well, since the beginning of the error line is env:
, it suggests that git.el is using the program "env" to find git and call it. Looking at the source confirms this since all calls to git appear to go through here:
(defun git-call-process-env (buffer env &rest args)
"Wrapper for call-process that sets environment strings."
(if env
(apply #'call-process "env" nil buffer nil
(append (git-get-env-strings env) (list "git") args))
(apply #'call-process "git" nil buffer nil args)))
Scanning through the code showed that in most cases, Emacs calls git directly with call-process
, but it sometimes uses the "env" command, particularly when it needs to pass environment variables (like "GIT_INDEX_FILE").
The problem is that Emacs doesn't pass it's exec-path
to env
when running it via call-process
, so setting exec-path
in Emacs won't help `env' find git.
There are really two solutions:
Figure out how to get env
to know where git is. I'm afraid I can't really help you on this one, since I don't know how to set up that sort of thing on a Mac, but it should be a fairly straightforward modification of PATH.
Hack git.el to pass PATH=/path/to/git
to env when calling git. This is less clean, but it's not all that bad of a hack, and especially if you made the choice of path into a defcustom
, it could be useful to others.
I would suggest starting out with 1, though. You can change the environment variables for Emacs using:
(setenv "PATH" (concat "/opt/local/bin:" (getenv "PATH")))
And trying git.el then. While Emacs doesn't pass the variable exec-path
to child processes, it does copy along its PATH environment variable from whatever it was invoked with. Since Emacs also calls git directly, you will also need to set exec-path
in the way that you already are.
Hope that helps.