Search code examples
gitemacsspacemacstrampmagit

Magit cannot find locally installed git version


I am trying to use Magit and TRAMP together in order to access git repositories on a server from a macOS laptop.

The server has git 1.7.12 as default, which is below the required version by Magit. I have installed git 2.9.5 to /my/local/path/bin I can check this by typing git --version using M-x shell via TRAMP the output is 2.9.5 as expected. The remote shell is zsh and the relevant local path is being set in .profile.


So as suggested at:

https://stackoverflow.com/a/37886703/3228006

I add the following to my dotspacemacs/user-config:

(require 'tramp)
(add-to-list 'tramp-remote-path "/my/local/path/bin")
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)

I then delete .emacs.d/.cache/tramp as suggested in the manual so that tramp does not attempt to reuse an old connection, and load spacemacs. I am greeted with:

1 error(s) on startup! Spacemacs may not be able to operate properly.

I use emacs --debug-init to find the cause

Error in dotspacemacs/user-config: Symbol's value as variable is void: path

Commenting out the lines I added removes the error which suggests to me that 'tramp-remote-path is void. This should not be the case as far as what I expected, especially since I added (require 'tramp) to be certain that tramp was loaded before accessing the remote path variable.

Removing require 'tramp does not solve the problem. Removing all three lines and doing C-h v 'tramp-remote-path outputs (before doing anything with tramp whatsoever):

(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin")

This is confusing as it seems to indicate that on startup the variable in question is not void. Furthermore, I have a version of emacs and spacemacs compiled up on the server, if I login and use magit there it finds my locally installed version of git no problem and everything works as expected.


If anyone is able to help debug further it would be greatly appreciated, thanks in advance.


Solution

  • Found a typo in my /.spacemacs the error I pasted above looked dodgy to me and I realised the line:

    (add-to-list 'tramp-remote-path "/my/local/path/bin")
    

    Was actually written as:

    (add-to-list 'tramp-remote path "/my/local/path/bin")
    

    Note the space between remote and path. Now that this is fixed deleting the cache again and reloading has fixed the issue.