GIT_SSH_COMMAND='ssh -i PATH/TO/KEY/FILE -o IdentitiesOnly=yes' git clone [email protected]:OWNER/REPOSITORY
or add the following config on the .gitconfig
[core]
sshCommand = ssh -i PATH/TO/KEY/FILE -o IdentitiesOnly=yes -F /dev/null
-
Configure git to use a specific SSH key for a repository permanently | Ru
-
📍 8 steps to manage multiple GitHub accounts | GitGuardian Blog
-
[Gist] Use Multiple SSH Keys for Git host websites (Github, Gitlab)
-
[Gist] How I configure multiple GitHub accounts using the 1password SSH agent (and working in WSL!)
-
[Gist] How To Work With Multiple Github Accounts on a single Machine
.gitconfig
[includeIf "gitdir:~/dev_work/"]
path = ~/.gitconfig_work
[includeIf "gitdir:~/dev_personal/"]
path = ~/.gitconfig_personal
.gitconfig_work
[credential]
helper = !aws codecommit credential-helper $@
UseHttpPath = true
[user]
name = Your Name
email = [email protected]
.gitconfig_personal
[user]
name = Your Name
email = [email protected]
signingKey = ~/.ssh/github/id_ed25519_personal.pub
[core]
sshCommand = ssh -i ~/.ssh/github/id_ed25519_personal -o IdentitiesOnly=yes -F /dev/null
[gpg]
format = ssh
[commit]
gpgsign = true