Git: Working with Multiple Accounts
Table of Contents
The Problem
If you are in a situation like I am where you have multiple GitHub accounts and you want to work with them on the same machine, it can be a big pain handling the github credentials while working with repos from two different accounts.
The Solution
The solution is to use the Git Credential Manager which is a cross-platform tool that manages your credentials for you. It let's you login to your GitHub accounts through the browser and then stores the credentials for you.
After you have followed the instructions to login to your first account, you simply run the following command:
git credential-manager github login
And login with your second account. Now when you interact with your repos it will ask you which account you want to use, and you just select the one that is authorized for that repo.