Skip to content

Instantly share code, notes, and snippets.

@8secz-johndpope
Created July 21, 2020 05:34
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 8secz-johndpope/603ae67d7a48bfd9b9c5ea8b7854f550 to your computer and use it in GitHub Desktop.
Save 8secz-johndpope/603ae67d7a48bfd9b9c5ea8b7854f550 to your computer and use it in GitHub Desktop.
~/.ssh/config file
# --- Sourcetree Generated ---
Host 8secz-johndpope-GitHub
HostName github.com
User 8secz-johndpope
PreferredAuthentications publickey
IdentityFile /Users/johnpope/.ssh/8secz-johndpope-GitHub
UseKeychain yes
AddKeysToAgent yes
# ----------------------------
@8secz-johndpope
Copy link
Author

8secz-johndpope commented Jul 21, 2020

To support multiple github ssh keys

generate new ssh work key
ssh-keygen

save the file clearly with work name / make sure you specify directory

~/.ssh/Github-WORKNAME-username

create a config file

cd ~/.ssh
touch config

update the User + IdentityFile (copy and paste above)

when you clone - use the ssh / and the users should match - eg. 8secz-johndpope
the cloned repo will correspond with the work keys

Screen Shot 2020-07-21 at 3 30 16 pm

make sure you use system git in sourcetree - to pick this up correctly.
Screen Shot 2020-07-21 at 4 32 15 pm

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