Git supports a number of environment variables one of them being
GIT_SSH. You can override the default ssh command (
ssh of course) with that environment variable.
GIT_SSH=./my_ssh git pull origin master
In this case
my_ssh is a bash executable file that looks like this:
#!/bin/bash ssh -i ~/.ssh/id_rsa $1 $2
An idea I got from this stack overflow answer.
Clearly the private key file I used is the default private key file so a bit redundant but its a way to add any options that might be necessary for the ssh connection, although specifying a host configuration in the ssh_config file might be simpler.Tweet