Skip to content

Instantly share code, notes, and snippets.

@rsperl
Last active July 25, 2022 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rsperl/2fd654522f968e6eee0a49a8edf47d55 to your computer and use it in GitHub Desktop.
Save rsperl/2fd654522f968e6eee0a49a8edf47d55 to your computer and use it in GitHub Desktop.
using multiple ssh keys with a single github instance #snippet

Create the ssh keys

ssh-keygen -t ed25519 -C my.email@example.com

# save to ~/.ssh/id_new_ssh_keys

Clone the repo

git clone -c "core.sshCommand=ssh -i ~/.ssh/id_new_ssh_keys -F /dev/null" git@github.com:example/example.git

# configuration saved in .git/config of the repo
# you can now use normal commands it will use the right keys

or for an existing repo

git config core.sshCommand "ssh -i ~/.ssh/id_new_ssh_keys -F /dev/null"

Src: https://superuser.com/a/912281

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment