Using multiple SSH identities with Git

Starting with version 2.10, Git allows the SSH command used for a single repo to be configured within the repository configuration.

Within the repo, run:

git config core.sshCommand "ssh -i ~/.ssh/id_rsa.github.alexnjose -F /dev/null"  

For initial clone of the repo, you can make use of the GIT_SSH_COMMAND environment variable:

GIT_SSH_COMMAND="ssh -i ~/.ssh/id_rsa.github.alexnjose -F /dev/null" \  
    git clone [email protected]:alexnj/dotfiles.git
comments powered by Disqus