Variable: magit-git-executable

magit-git-executable is a customizable variable defined in magit-git.el.

Value

"git"

Documentation

The Git executable used by Magit on the local host.

On remote machines magit-remote-git-executable is used instead.

This variable was added, or its default value changed, in magit version 3.2.0.

Source Code

;; Defined in ~/.emacs.d/elpa/magit-20260411.1452/magit-git.el
(defcustom magit-git-executable
  (or (and (eq system-type 'windows-nt)
           ;; Avoid the wrappers "cmd/git.exe" and "cmd/git.cmd",
           ;; which are much slower than using "bin/git.exe" directly.
           (and-let ((exec (executable-find "git")))
             ;; Git for Windows 2.x provides cygpath so we can
             ;; ask it for native paths.
             (let* ((core-exe
                     (car (magit--early-process-lines
                           exec "-c"
                           "alias.X=!x() { which \"$1\" | cygpath -mf -; }; x"
                           "X" "git")))
                    (hack-entry (assoc core-exe magit--git-w32-path-hack))
                    ;; Running the libexec/git-core executable
                    ;; requires some extra PATH entries.
                    (path-hack
                     (list (concat "PATH="
                                   (car (magit--early-process-lines
                                         exec "-c"
                                         "alias.P=!cygpath -wp \"$PATH\""
                                         "P"))))))
               ;; The defcustom STANDARD expression can be
               ;; evaluated many times, so make sure it is
               ;; idempotent.
               (if hack-entry
                   (setcdr hack-entry path-hack)
                 (push (cons core-exe path-hack) magit--git-w32-path-hack))
               core-exe)))
      (and (eq system-type 'darwin)
           (executable-find "git"))
      "git")
  "The Git executable used by Magit on the local host.
On remote machines `magit-remote-git-executable' is used instead."
  :package-version '(magit . "3.2.0")
  :group 'magit-process
  :type 'string)