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
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"
In my case, I will do as below:
$ ssh-keygen -t rsa -C "[email protected]" -f "githubshriDemoOne"
$ ssh-keygen -t rsa -C "[email protected]" -f "githubshriDemoTwo"