I have this error when I start emacs:

File error: Searching for program, no such file or directory, git

My Git is inside the VM in /usr/bin/git

How can I point emacs to it?

I'm using tramp and plink to communicate the VM and emacs.

I tried leaving in the .emacs file

(add-to-list 'exec-path "/plink:[email protected]:/usr/bin/")

But it didn't help.

I also tried to install Git into windows but then when I visit Git repositories in the VM, Git from windows doesn't have access to the remote FS. Specifically, I press M-x magit, and emacs says:

Git repository:<path to where I am>

Then I press enter

Then it says:

 Create repository in /plink:[email protected]:<path to where I am>

Whether I press Y or N, it doesn't help me.

Does anyone have any suggestions? How do I configure Magit to use the git binary on the remote machine?


2 Answers 2


Tramp doesn't use exec-path, it uses tramp-remote-path. See https://www.gnu.org/software/tramp/#Remote-programs.


The variable magit-git-executable can be customized. Its documentation:

magit-git-executable is a variable defined in ‘magit-git.el’. Its value is "git"

Documentation: The Git executable used by Magit.

So, you should be able to set it to something like [email protected]/usr/bin/git:

(setq magit-git-executable "[email protected]/usr/bin/git")

I don't have a VM handy to test this with, but that should do it. You might run into problems where Emacs passes fully-qualified paths to git, but that might cause problems with git.

  • Sorry. I doesn't work. It makes it even worse. Now emacs throws error all the time and even C-x C-f doesn't work and instead I get Error in post-command-hood (magit-auto-revert-mode-check-buffers) : (file-error "Seaching for program" "no such file or directory" "/[email protected]:/usr/bin/git" Dec 13, 2016 at 17:57
  • Can you try it without an opening slash? So "[email protected]:/usr/bin/git", not "/[email protected]:/usr/bin/git".
    – zck
    Dec 13, 2016 at 19:36
  • Hi zck. I tried, it didn't work either. It still asks me git repository: <my current dir>... Basically, same as before. Dec 14, 2016 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.