10

I'm using ssh to connect to a remote server. On the server there is a git repo called MRFLSSVM. However, when I execute magit-status on:

/ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/

Magit asks me to Create repository in /ssh:qmServer:/home/Chang/qmCodeLab/MRFLSSVM/?.

Any idea how to let magit recognize that repo? (I've already installed git 2.10.0 on /usr/local/git and configured my system (CentOS) to use it by update-alternatives)

-----------Edit------------------------------

Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3.

If this comes as a surprise to you, because you do actually have
a newer version installed, then that probably means that the
older version happens to appear earlier on the `$PATH'.  If you
always start Emacs from a shell, then that can be fixed in the
shell's init file.  If you start Emacs by clicking on an icon,
or using some sort of application launcher, then you probably
have to adjust the environment as seen by graphical interface.
For X11 something like ~/.xinitrc should work.

If you use Tramp to work inside remote Git repositories, then you
have to make sure a suitable Git is used on the remote machines
too.

Error (magit): Magit requires Git >= 1.9.4, but on /ssh:qmServer: the version is 1.8.3.

If multiple Git versions are installed on the host then the
problem might be that TRAMP uses the wrong executable.

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 use the correct executable, then consult the info node
`(tramp)Remote programs'.

This problem seems to be tramp is not using the correct git on remote server. I've tried to change magit-git-executable to usr/local/git/bin/git which is the path both of my local and remotes installed git. But this still doesn't work.

Any ideas to solve this? Thanks!

10
  • 1
    Works for me. I'm guessing that the version of git on the remote server is too old. Magit 2 requires a minimum git version of 1.9.4.
    – phils
    Commented Sep 30, 2016 at 4:19
  • Note that Magit over tramp is likely to be significantly slower than a local instance. In these cases I much prefer to ssh to the remote server in a terminal, and run Emacs (in the terminal) on that server. Then all of the git operations are local and fast.
    – phils
    Commented Sep 30, 2016 at 4:22
  • Well I think your main problem is that the remote server doesn't have a recent-enough version of git on it. Regardless of where you're running Emacs, Magit 2 needs that server to be running git 1.9.4 or later. Magit 1 is still available, and works with much older versions of git, so you could try using that instead. (I can't remember whether Magit 1 works over tramp, however.)
    – phils
    Commented Sep 30, 2016 at 4:36
  • @phils I've updated server's git to 2.8.1, but it still doesn't work. How can I find the problem? I'm a spacemacs user. Does this has anything to do with spacemacs?
    – spacegoing
    Commented Sep 30, 2016 at 4:36
  • That seems really unlikely to me, but I don't know. You'll have to test and find out, I guess. I'm sorry to hear that didn't work; I was fairly confident that was the issue (was it running a version older than 1.9.4 originally?). If you didn't already, make sure you restart Emacs before testing, just in case that makes a difference.
    – phils
    Commented Sep 30, 2016 at 4:40

2 Answers 2

6

Error (magit): Magit requires Git >= 1.9.4, you are using 1.8.3.

I've already installed git 2.10.0 on /usr/local/git

The list of directories to search for executables on remote hosts is controlled by the option tramp-remote-path. It does begin with a "what the remote told me what I should be using" element, but in my experience that doesn't work so well. In particular it does ignore any changes to $PATH that you have made in your shell's configuration file, I believe.

So, in your init file, put /usr/local/git/bin before /usr/bin in tramp-remote-path:

(require 'tramp)
(push "/wherever/git/is/" tramp-remote-path)
0

If your git version is fine, the issue may be with the configuration of this git repository, for instance a syntax error in .git/config.

In order to check for that, open a shell on the repository machine and directory, and type git status

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.