Search code examples
gitmercurialsshcustom-actionssh-keys

Git custom SSH command


I am trying to find a way to run git with a custom ssh command when needed. I do not want to use any configuration files or environmental variables. I would just like to use something like the -e sshcommand option than Mercurial gives.


Solution

  • The way you use a custom ssh command line with git is:

    • via the GIT_SSH environment variable, or
    • by adding a stanza to ~/.ssh/config that matches your target host

    This answer explores the GIT_SSH solution in more detail.

    There is otherwise no direct equivalent to the -e command line in Mercurial.