Git Set SSH Command
To change the ssh
command used by Git when connecting to a remote system we can use the core.sshCommand
config option or the GIT_SSH_COMMAND
environment variable.
Set the SSH Command Globally
bash
$# Set the SSH command to use a specific SSH key
$git config --global core.sshCommand "ssh -i ~/.ssh/id_rsa"
Set Using An Environment Variable
bash
$# Can be added to your ~/.profile or ~/.bash_profile
$export GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa"