Environment Variables in hgrc and SSH
Wagner Bruna
wagner.bruna+mercurial at gmail.com
Mon Jan 10 06:23:52 CST 2011
On 01/10/2011 08:26 AM, A. S. Budden wrote:
> I have a common set of hg configurations that I keep under (hg)
> version control and I keep a copy on all the machines I use. In the
> main file, I have the line:
>
> %include $HOSTNAME.hgrc
>
> to allow a few customisations for each PC. This seems to work
> absolutely fine for normal operation (although I had to add 'export
> HOSTNAME' to .bashrc first).
>
> However, when I connect to one of the PCs with this configuration
> using ssh, I get:
>
> [local]$ # In a branch linked to ssh://username@hostname//path/to/repository
> [local]$ hg pull -u
> remote: hg: parse error at
> /home/al/config/mercurial_config/hgrc:26: cannot include
> /home/al/config/mercurial_config/$HOSTNAME.hgrc (No such file or
> directory)
> abort: no suitable response from remote hg!
>
> I think the problem is due to the exporting of the HOSTNAME variable
> under ssh (so I guess this may strictly be more of an Ubuntu question
> than a mercurial question):
>
> [local]$ ssh username at hostname hg showconfig
> hg: parse error at /home/al/config/mercurial_config/hgrc:26:
> cannot include /home/al/config/mercurial_config/$HOSTNAME.hgrc (No
> such file or directory)
>
> [local]$ ssh username at hostname
> [remote]$ hg showconfig
> # This works fine
> [remote]$ exit
>
> [local]$ ssh username at hostname 'echo $HOSTNAME'
> # This works too: without the single quotes it prints the local
> hostname; with them it prints the remote one.
>
> I've tried adding 'export HOSTNAME' to ~/.profile, ~/.bashrc and to a
> new file called /etc/profile.d/exports.sh (all on the remote machine),
> but none of these seemed to have helped.
>
> Does anyone know of the correct way to make this work?
You probably need to add the variable to ~/.ssh/environment ; search
for "environment" on the ssh man page.
Regards,
Wagner
> Many thanks in advance,
>
> Al
More information about the Mercurial
mailing list