Skip to content

Instantly share code, notes, and snippets.

View yemisprojects's full-sized avatar

Yemi Odunade yemisprojects

View GitHub Profile
@yemisprojects
yemisprojects / multiple_ssh_setting.md
Created August 1, 2022 05:54 — forked from jexchan/multiple_ssh_setting.md
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.