Search code examples
gitemacssshtrampsshfs

how to make emacs + egg (git) work with remote files (accessed via ssh)


I have emacs + egg working correctly when accessing repos/dirs/files that are in my local system.

Also, opening and editing files via ssh works fine, e.g.

ctrl-f /ssh:jds@dev.acme.com:/home/jds/src/test.py

but then when executing egg-status, I get...

Opening input file: no such file or directory, /HEAD

Note that if I open a shell and ssh into the remote system, all git commands work correctly.

Thanks for any help to get this to work.


Solution

  • I agree with Alex's answer that you should use the more advanced and awesome magit package.

    The longer story about why egg doesn't work the way you want is this: The way egg is written it cannot operate on remote files with TRAMP because egg.el uses the call-process function, whereas magit uses start-file-process which is supported as described in the Remote Processes section of the TRAMP manual:

    5.4 Integration with other Emacs packages.
    
    tramp supports running processes on a remote host. This allows to
    exploit Emacs packages without modification for remote file names.
    [...]
    process-file and start-file-process work on the remote host when the
    variable default-directory is remote:
    
         (let ((default-directory "/ssh:remote.host:"))
           (start-file-process "grep" (get-buffer-create "*grep*")
                               "/bin/sh" "-c" "grep -e tramp *"))