DEV Community

Cover image for Manage Multiple GitHub accounts with ease.
Shrinidhi A
Shrinidhi A

Posted on • Edited on

Manage Multiple GitHub accounts with ease.

We all know, that when we enter IT we have to work on git. we may have to work on different git accounts. some may get to work on different accounts from the company or they may have to manage both the company GitHub account and their personal GitHub account.

Yeah! we can use GitHub Desktop but we have to log in and log out again and again to work on different accounts. to make things simple let's learn to manage two or more GitHub accounts at once from Powershell.

let me consider I have two GitHub accounts.

  • github.com/shriDemoOne.
  • github.com/shriDemoTwo.

I will suggest Windows users use git bash to execute the below commands.

Step 1: Creating SSH keys for all your accounts.

change your current working directory to .ssh

$ cd ~/.ssh
Enter fullscreen mode Exit fullscreen mode

generate a unique SSH key for all your accounts. execute the below command to all your accounts by replacing your email address and username.

$ ssh-keygen -t rsa -C "emailAddressOfAcount" -f "usernameOfAccount"
Enter fullscreen mode Exit fullscreen mode

In my case, I will do as below:

$ ssh-keygen -t rsa -C "shriDemoOne@gmail.com" -f "githubshriDemoOne"
$ ssh-keygen -t rsa -C "shriDemoTwo@gmail.com" -f "githubshriDemoTwo"
Enter fullscreen mode Exit fullscreen mode

Step 2: Add generated SSH keys to the GitHub account

Top comments (1)

Collapse
 
khuongduybui profile image
Duy K. Bui

Are you going to elaborate on how to config which GitHub repos to use which keys or something equivalently?
As for myself I have switched to using GitHub CLI credential helper for authentication and never looked back.