How to configure Multiple GIT accounts in Computer

In this post, we will learn how to configure multiple github accounts on windows machine using SSH keys which is the most preferred way instead of HTTP authentication.

Here are the steps configure SSH keys in GITHUB. Let’s assume you have company and personal github account which you may need access to on your windows.

Configure GIT Hub account 1 with SSH Keys:

  1. Navigate to C:\Users\{userName}\.ssh. if folder is created, otherwise ignore it. ssh folder will be automatically created for you when you run ssh-keygen command

2. Open command prompt or gitbash which ever you comfortable.

3. Create ssh key file with with ssh-keygen command as shown in below. Leave empty value when you prompt for “Enter File in which to save”. It will create id_rsa file which is default name

 ssh-keygen -t rsa -b 4096 -C "
"Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jayaramp/.ssh/id_rsa):

4. Copy the content of file and paste it in your github ssh key settings. Logon to with company account and navigate

5. Access SSH details page: Profile ==> Setting ==> SSH and GPG Keys

6 Click on “New SSH Key” to add content of file

7. Add SSH Key by giving the Title as “MyCompanyKey” and paste the contents into the key text area.

8. Finally you configure SSH key and look like below

Now you can access company repositories with this account and by default id_rsa file will be loaded to communicate with

Configure second GIT hub account with SSH key

As git clone, always refers id_rsa file then how to access personal github account. In this case, my personal user is jayaram509( and create SSH key for this account

  1. Create SSH key for personal user “” as shown below:
$ ssh-keygen -t rsa -b 4096 -C ""
Generating public/private rsa key pair.
Enter file in which to save the key (/c/Users/jayaramp/.ssh/id_rsa): personal
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in personal
Your public key has been saved in

2. In the Enter file name command, give name as personal and it creates SSH key with follows as

3. Copy the SSH keys from to jayaram509 github account as shown in below:

How to access personal GIT account now?

As shown in below, lets try to access the repo with

When you try to access the personal repository on your machine then by default it will load id_rsa instead of

Create Config file in .ssh folder

  1. Navigate to again “C:\Users\jayaram\.ssh” folder
  2. create config file in .ssh folder as shown in below
Copy the below content to config file and save it.
 User git
 IdentityFile ~/.ssh/id_rsa
 User git
 IdentityFile ~/.ssh/personal

Make sure that config file should be created of type File not with of .txt extension, as shown in below

Now, if you try to access personal account repository with the host name as “” which is Host in above config file

with that, new personal git clone URL is : git@

D:\GITDemo>ssh -T
Warning: Permanently added the RSA host key for IP address '' to the list of known hosts. Permission denied (publickey).

D:\GITDemo>ssh -T Permission denied (publickey).

D:\GITDemo>git clone
Cloning into 'helloworld-personal-repo'...
Enter passphrase for key '/c/Users/jayaramp/.ssh/personal':
warning: You appear to have cloned an empty repository.

Hope this helps. Now can you access multiple GITHUB accounts on Windows

Leave a Reply

Your email address will not be published. Required fields are marked *