Is it possible to get git to use something other than "ssh" as the ssh program? Rsync has a -e option for this purpose, and other interfaces where rsh or ssh can be used as the transport. The particular use case I have is chaining the ssh connection via a bastion host, as direct ssh access to the host from which I'm cloning / pulling is not allowed by the firewall.
The best solution I've come up with so far is to create a directory with a single executable called "ssh" in it, and put that directory at the start of my PATH. The contents of the "ssh" file is:
#!/bin/sh
# If we were being clever we'd look at where we were and just snip that
# off the path.
export PATH=/bin:/usr/bin:/sbin:/usr/sbin
exec ssh bastion.example.org ssh "$@"
This works, but the approach has a number of drawbacks.
Note that the GIT_SSH environment variable doesn't do what I'm after, as you still have to create a script and reference that. Whereas with rysnc's -e option I can do
rsync -e 'ssh -K bastion.example.org ssh' ...