I have the following in my .emacs:
(require 'tramp)
(add-to-list 'tramp-remote-path "/some/path")
(add-to-list 'tramp-remote-path 'tramp-default-remote-path)
so when I open a file using tramp over ssh, I expect my PATH
to contain /some/path
. Instead, running M-! echo $PATH
returns
/bin:/usr/bin:/usr/sbin:/usr/local/bin
Even if I set export PATH=/hwdisks/data/modules/pkg/git/1.8.4.1/bin/git:$PATH
in .bashrc
or .profile
, PATH
is not set correctly.
In the tramp log, *debug tramp/ssh remotehost*
, I can see tramp explicitly setting PATH
:
12:28:34.202135 tramp-send-command (6) # PATH=/bin:/usr/bin:/usr/sbin:/usr/local/bin; export PATH
If I include echo "in .bashrc"
in my .bashrc
, it appears in the tramp log, so I know tramp is reading it.
How can I make tramp use the correct PATH
?
Emacs version: 24.2.1
Tramp version: 2.2.3-24.1
Embarrassingly, the answer is in the tramp manual:
Another possibility is to reuse the path settings of your remote account when you log in. Usually, these settings are overwritten, because they might not be useful for tramp. The place holder tramp-own-remote-path preserves these settings. You can activate it via
(add-to-list 'tramp-remote-path 'tramp-own-remote-path)
I'm still not sure why it ignores the other paths added to tramp-remote-path
.