Honour the $GIT_SSH on unix #242

dlmiles opened this Issue Apr 16, 2012 · 4 comments


None yet

2 participants


man git # has documentation on GIT_SSH but when hg-git forks to execve() the ssh command it does not make use of the environment variable when it is set.

This should be a simple matter to fix by looking up the environment variable and using that value as the command to run, if it is the environment variable is not set it uses the "ssh" default (just as is the case now).

After running strace on 'hg'
$ strace -s 1024 -f -o /tmp/hg.txt hg push git+ssh://git@mydomain.org:19418/oss/mirror/repo.git

$ grep " execve" /tmp/hg.txt
7137 execve("/bin/sh", ["/bin/sh", "-c", "ssh git@mydomain.org -p 19418 'git-receive-pack '\''/oss/mirror/repo.git'\'''"], [/* 101 vars /]
7137 <... execve resumed> ) = 0
7137 execve("/usr/bin/ssh", ["ssh", "git@mydomain.org", "-p", "19418", "git-receive-pack '/oss/mirror/repo.git'"], [/
100 vars */]) = 0

$ set | grep GIT_SSH


This doesn't at all seem like the right thing to do - instead we should honor Mercurial's ssh configuration and do configuration that way.


(For what it's worth, I'm not at all sure we respect hg's settings for that either.)


We respect the Mercurial ui.ssh setting, which is how you should be configuring Mercurial (and by association hg-git) for alternate ssh transports. You can do this on a per-repository basis by editing .hg/hgrc if needed.

@durin42 durin42 closed this Apr 16, 2012

I think you should use Mercurial settings when talking to HG server and GIT policies way when talking to a git server. This matters shows up when talking the git server.

Using HG configuration allows for a completely separate HG SSH configuration to a GIT SSH configuration ? when even they have the same SSH username, SSH hostname and SSH port numbers ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment