git using different ssh key
-
First, generate new keygen
# ssh-keygenNote: ensure id_rsa filename is a custom name, not default "id_rsa".
Example: ~/.ssh/id_rsa_custom_keyThen, add the custom key in github/git source
Then, clone/pull using command below using custom key
GIT_SSH_COMMAND='ssh -i ~/.ssh/id_rsa_custom_key' git clone [email protected]:chromium/chromium.gitRef: https://ma.ttias.be/specify-a-specific-ssh-private-key-for-git-pull-git-clone/
-
File: ~/.ssh/config
Host github.com IdentityFile ~/.ssh/id_rsa_custom_key IdentitiesOnly yesCreate this file in the server, so it always execute this by default.
-
A aizu pinned this topic
-
A aizu moved this topic from Ref