There is no direct option available in git to specify a private key while executing git command. You can configure git config file or use the below hack to specify the private SSH-key to use when executing git command.
1 2 3 4 |
GIT_SSH_COMMAND='ssh -i /some/where/private_key_file -o IdentitiesOnly=yes' git clone user@host:repo.git ## Make sure you change the permission of your private key chmod 400 /some/where/private_key_file |