title: Configuring PATH globally for SSH remote commands
body: <p>I have a problem with the PATH variable on Debian Linux when executing commands via SSH. This happens for example when I use GIT or Mercurial and I have them installed in /opt instead of /usr/local. But I can also reproduce this easily like this:</p>
  
  <p>When I login to the server via SSH in a normal way and then do <code>echo $PATH</code> then I get the PATH which I have configured in /etc/profile:</p>
  
  <pre>/usr/local/bin:/usr/bin:/bin:/usr/games:/opt/maven/bin:/opt/ant/bin:/opt/mercurial/bin:/opt/git/bin</pre>
  
  <p>But when I do <code>ssh user@server 'echo $PATH'</code> instead then I get this:</p>
  
  <pre>/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games</pre>
  
  <p>The same happens when I use GIT or Mercurial with an ssh URL. It can't find hg or git executable on the server because it don't get the PATH from /etc/profile.</p>
  
  <p>So the question is: Is there a "more global" way to configure the PATH so it also works with SSH remote execution? Configuring the PATH per user is not an option. Specifying the full path to git/hg executables when using git/hg on the client is also not an option. And I know that I could use symlinks or wrapper scripts in /usr/local/bin to get it working but I'm searching explicitly for a possibility to have a correct PATH when executing commands remotely via SSH.</p>