Sep 14, 2016
words
If you happen to be using different git accounts with they're own SSH keys; i.e. you use different keys for deployment, personal, company A, company B, etc.
Then you probably have wondered how to tell git which key to use to manage the repo.
You could use the git-remote-ext utility.
cloning new projects
$ git clone "ext::ssh -i /path/ssh/key [email protected] %S /gituser/repo.git"
existing projects
Edit the .git/config
file directly or via the terminal:
$ git remote remove origin
$ git remote add origin "ext::ssh -i /path/ssh/key [email protected] %S /gituser/repo.git"
verifying new remote origin
$ git remote -v
origin ext::ssh -i /path/ssh/key [email protected] %S /gituser/repo.git (fetch)
origin ext::ssh -i /path/ssh/key [email protected] %S /gituser/repo.git (push)
$ git fetch