Wednesday, July 24, 2019

Git using a different SSH private key

Git, by defaut uses the ssh private key at ~/.ssh/id_rsa. 
But if you want to use another key at another location, then do the following:
export GIT_SSH_COMMAND="ssh -i ~/.ssh/KeyName"
You can add this in your .bashrc file as an alias:
alias pgit='export GIT_SSH_COMMAND="ssh -i ~/.ssh/KeyName"'

No comments:

Post a Comment