7.4 Using Plink with Git

To use Plink for Git operations performed over SSH, you can set the environment variable GIT_SSH_COMMAND to point to Plink.

For example, if you've run PuTTY's full Windows installer and it has installed Plink in the default location, you might do this:

set GIT_SSH_COMMAND="C:\Program Files\PuTTY\plink.exe"

or if you've put Plink somewhere else then you can do a similar thing with a different path.

This environment variable accepts a whole command line, not just an executable file name. So you can add Plink options to the end of it if you like. For example, if you're using Git in a batch-mode context, where your Git jobs are running unattended and nobody is available to answer interactive prompts, you might also append the ‘-batch’ option (section 7.2.3.1):

set GIT_SSH_COMMAND="C:\Program Files\PuTTY\plink.exe" -batch

and then if Plink unexpectedly prints a prompt of some kind (for example, because the SSH server's host key has changed), your batch job will terminate with an error message, instead of stopping and waiting for user input that will never arrive.

(However, you don't always want to do this with Git. If you're using Git interactively, you might want Plink to stop for interactive prompts – for example, to let you enter a password for the SSH server.)