2

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:asti@192.168.33.10:/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:asti@192.168.33.10:<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?

Thanks

2

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

0

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 asti@192.168.33.10/usr/bin/git:

(setq magit-git-executable "asti@192.168.33.10/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" "/asti@192.168.33.10:/usr/bin/git" – Jenia Ivanov Dec 13 '16 at 17:57
  • Can you try it without an opening slash? So "asti@192.168.33.10:/usr/bin/git", not "/asti@192.168.33.10:/usr/bin/git". – zck Dec 13 '16 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. – Jenia Ivanov Dec 14 '16 at 15:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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