Next: , Previous: , Up: Running Git   [Contents][Index]

4.6.4 Git Executable

Except on MS Windows, Magit defaults to running Git without specifying the path to the git executable. Instead the first executable found by Emacs on exec-path is used (whose value in turn is set based on the value of the environment variable $PATH when Emacs was started).

This has the advantage that it continues to work even when using Tramp to connect to a remote machine on which the executable is found in a different place. The downside is that if you have multiple versions of Git installed, then you might end up using another version than the one you think you are using.

M-x magit-version     (magit-version)

This command shows the currently used versions of Magit, Git, and Emacs in the echo area. Non-interactively this just returns the Magit version.

When the system-type is windows-nt, then magit-git-executable is set to an absolute path when Magit is first loaded. This is necessary because Git on that platform comes with several wrapper scripts for the actual git binary, which are also placed on $PATH, and using one of these wrappers instead of the binary would degrade performance horribly.

If Magit doesn’t find the correct executable then you can work around that by setting magit-git-executable to an absolute path. But note that doing so is a kludge. It is better to make sure the order in the environment variable $PATH is correct, and that Emacs is started with that environment in effect. The command magit-debug-git-executable can be useful to find out where Emacs is searching for git. If you have to connect from Windows to a non-Windows machine, then you must change the value to "git".

User Option: magit-git-executable

The git executable used by Magit, either the full path to the executable or the string "git" to let Emacs find the executable itself, using the standard mechanism for doing such things.

M-x magit-debug-git-executable     (magit-debug-git-executable)

Display a buffer with information about magit-git-executable.

Next: , Previous: , Up: Running Git   [Contents][Index]