I'm scratching my head on this problem, but I cannot seem to use magit on a project served over plink or plinkx on Windows.

What does work:

  • The windows client can use magit on a project stored locally (e.g. from C:\)
  • The windows client can connect fine to the remote project (dired works, as does find-file)
  • A WSL2 Emacs instance works fine from the same laptop, only using ssh instead of plink

What happens when I try using plink(x):

  1. In a file in a git repository, I run magit-status
  2. Instead of the normal buffer, I'm asked for the "Git repository:" in the mini-buffer. The value defaults to the current directory.
  3. Whatever I try as a value for "Git repository", I'm presented with "Create repository in $FOO? (y or n)
  4. If I select y I'm told "Not inside git repository"

Does anyone have any idea what's going on? I'm running GNU Emacs 27.1 (build 1, x86_64-w64-mingw32) of 2020-08-21 according to (emacs-version).

It's not a deal-breaker to me as I'm using WSL2 and an X-Server, but I'm curious and hopefully this will help my understanding of both TRAMP and magit, so any tips appreciated.


I've found the issue. The error messages as posted in the question could have been a little more helpful. The error messages were unambiguous when I ran (magit-status "/plink:....") from the scratch buffer:

Error (magit): Magit cannot find Git on /plink:$HOST:.

First check the value of `magit-git-executable'.  Its value is
used when running git locally as well as when running it on a
remote host.  The default value is "git", except on Windows
where an absolute path is used for performance reasons.

If the value already is just "git" but TRAMP never-the-less
doesn't find the executable, then consult the info node
`(tramp)Remote programs'.

TL;DR: Adding (setq magit-git-executable "git") to my .emacs.d/init.el fixed it for me.

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.