Manage multiple GitHub accounts and AWS CodeCommit: Short post


This post describes how to manage ssh keys for several GitHub accounts and AWS CodeCommit. Even though I'm using AWS CodeCommit, this can be applied to other service providers as well.

Currently, I manage my personal Github, company GitHub, and company AWS CodeCommit. I have three ssh key pairs all together.

Below is the ssh config file (C:\Users\harsha-xcompany\.ssh\config)

How to clone

When cloning we have to use the Host values in the config file. I have replaced the host of the URL with the host value in the config file.

1. Personal account

Original URL:
After replacing host (No need to replace since both host values are the same): 
git clone

2. Company GitHub account

Original URL:
After replacing host: 
git clone git@github.xcompany-co:xcompany-co/cognito_cloudformation_project.git

3. AWS CodeCommit account

Original URL: 
After replacing host: 
git clone ssh://github-xcompany/v1/repos/xcompany-admin-panel

Once you have cloned properly, you can continue with other git commands.

git config

For personal repositories. I used my Github username and email.
git config --local "h-hub"
git config ""

For the AWS CodeCommit account, I used my name and company email.
git config --local "harsha Jayamanna"
git config ""

Make sure to cofig before committing any changes because otherwise, your commits won't show your profile properly.

git commits