Set GIT_SSH Environment Variable in Gitconfig

git, git-config

Solution

Since my 2013 answer (Git 1.8.3.4), a new configuration has been set: `core.sshCommand`

If this variable is set, `git fetch` and `git push` will use the specified command instead of `ssh` when they need to connect to a remote system. The command is in the same form as the `GIT_SSH_COMMAND` environment variable and is overridden when the environment variable is set.

It has been introduced in Git 2.10, commit 3c8ede3, June 2016

Since then, you have Git 2.13, commit dd33e077, Feb. 2017, which has `ssh.variant`

Depending on the value of the environment variables `GIT_SSH` or `GIT_SSH_COMMAND`, or the config setting `core.sshCommand`, Git auto-detects whether to adjust its command-line parameters for use with plink or tortoiseplink, as opposed to the default (OpenSSH).

The config variable `ssh.variant` can be set to override this auto-detection; valid values are `ssh`, `plink`, `putty` or `tortoiseplink`. Any other value will be treated as normal ssh. This setting can be overridden via the environment variable `GIT_SSH_VARIANT`.

For those, I need to use the SSH client that Git for Windows came with

So for the repos where you need ssh instead of putty, you can use both settings to set exactly in your configuration what you want.

 cd /path/to/my/repo
 git config ssh.variant ssh

Problem

Is there a way to set the GIT_SSH environment variable in the gitconfig file?

Original source

Related problems