0

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?

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.