Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find git executable

Tags:

emacs

macos

magit

I'm using Emacs 24 on OS X 10.6.8. Doing magit-status says

Searching for program: no such file or directory, git

However, the Emacs shell is able to find git, so this does not seem to be a $PATH issue. What else could it be?

like image 359
Pranav Avatar asked Sep 12 '12 18:09

Pranav


People also ask

Where is git installed on my PC?

To see if Git is installed on your system, open your terminal and type git --version . If your terminal returns a Git version as an output, that confirms you have Git installed on your system.

How do I fix git not found?

Download and Install Git making sure Use Git from the Windows Command Prompt is selected when prompted. At the end, reopen the Command Prompt. The git command should now be recognized as expected. In some cases, a computer restart may be needed.

How do I know if git is installed Windows?

Checking for Git Once you've opened your terminal application, type git version . The output will either tell you which version of Git is installed, or it will alert you that git is an unknown command.

Which executable is installed git on Windows?

Installing Git on Windows. Go to Git's download page and click “Windows”. An .exe file should be downloaded to your “Downloads” folder. Open the downloaded Git .exe file.


1 Answers

Try checking the value of exec-path variable. This controls the directories which are looked by Emacs for external executables (including git).

This is a customizable variable, and you can add the path to git to the list of existing directories.

I have the elisp snippet in my .emacs.d/init.el file for my Emacs install under OSX, which sets both the PATH and exec-path correctly.

;;; Set localized PATH for OS X
(defun my-add-path (path-element)
  "Add the specified PATH-ELEMENT to the Emacs PATH."
  (interactive "DEnter directory to be added to path: ")
  (if (file-directory-p path-element)
     (progn
       (setenv "PATH" (concat (expand-file-name path-element) path-separator (getenv "PATH")))
       (add-to-list 'exec-path (expand-file-name path-element)))))

(if (fboundp 'my-add-path)
   (let ((my-paths (list "/opt/local/bin" "/usr/local/bin" "/usr/local/git/bin")))
      (dolist (path-to-add my-paths (getenv "PATH"))
         (my-add-path path-to-add))))
like image 144
Anupam Avatar answered Oct 03 '22 15:10

Anupam