Reputation: 16065
From the docs on GIT_SSH
environmental variable:
GIT_SSH, if specified, is a program that is invoked instead of ssh when Git tries to connect to an SSH host. It is invoked like $GIT_SSH [username@]host [-p ] . Note that this isn’t the easiest way to customize how ssh is invoked; it won’t support extra command-line parameters, so you’d have to write a wrapper script and set GIT_SSH to point to it. It’s probably easier just to use the ~/.ssh/config file for that.
However, when I try to do something like
GIT_SSH="ssh -i /path/to/key" git clone <repo_url>
it works just fine. Why does the documentation say that no extra command-line parameters are supported?
Upvotes: 0
Views: 399
Reputation: 1323743
That documentation is not up-to-date, and does not mention the actual environment variable that introduced extra command-line parameters: GIT_SSH_COMMAND
(Git 2.10+, Q3 2016.
It is also configurable with the setting core.sshCommand
.
Since Git 2.10, GIT_SSH
and GIT_SSH_COMMAND
has been made equivalent.
The setting ssh.variant
replaces what GIT_SSH
did before.
Upvotes: 1