Managing multiple Github Accounts

Oh no, why is my work not being pushed up to my GitHub!?
  1. Create ssh file locally
  • Before creating a new file, make sure you are in the appropriate directory. I created my ssh file under Users/gracenakano and then cd (stands for change directory) into the newly created file.
Users/gracenakano touch .ssh
Users/gracenakano cd .ssh
  • Enter your personal email address associated with the account
Users/gracenakano cd .ssh
.ssh ssh-keygen -t rsa -b 4096 -C ""
.ssh id_rsa_personal
  • Go through the same process to generate a rsa key pair for your work account, entering the work email associated to your work GitHub account.
.ssh ssh-keygen -t rsa -b 4096 -C ""
.ssh id_rsa_work
.ssh ls
id_rsa_personal id_rsa_work
.ssh cat
  • Take the return SSH key value and copy and paste into your GitHub account.
  • In your GitHub account, go to Settings => SSH and GPG keys => New SSH Key.
  • Add title to key. You can call it anything such as “Grace’s MacBook”. Paste the SSH key to the body. Click Add SSH key
  • Repeat the process for your work account. Make sure to log out of your personal Github account and sign into your work account before continuing the process.
.ssh cat
  • You can title the key the same in your work account. Just make sure to copy and paste the correct SSH key.
.ssh touch config
.ssh nano config
# Personal account - default config
User git
IdentityFile ~/.ssh/id_rsa_personal
# Work account
User git
IdentityFile ~/.ssh/id_rsa_work
  • Let’s start with the personal account:
.ssh cd
~ nano ~/.gitconfig
  • Add to the file:
name = Grace Nakano
email =
[includeIf "gitdir:~/work/"]
path = ~/work/.gitconfig
~ mkdir work
~ nano ~/work/.gitconfig
  • Add to file:
name = gracenakano
email =
~ cd .ssh/
.ssh ssh-add id_rsa_personal
.ssh ssh-add id_rsa_work
# to see our list of keys .ssh ssh-add -l
# personal
.ssh ssh -T
// prompt to continue => yesHi gracenak! You've successfully authenticated, but GitHub does not provide shell access# work
.ssh ssh -T
// prompt to continue => yesHi gracenakano! You've successfully authenticated, but GitHub does not provide shell access
  • add hostname in the following (indicated in bold below)
~ cd work/
work git clone
  • we can check to see if we have cloned down and connected to the correct GitHub account
work cd test/
work/test git config
  • follow the same procedure for your personal account by cloning down a personal repository via SSH and add host name as sampled above.
  • create branch and add file
work/test git checkout -b test
work/test touch test.rb
git add .
work/test git commit -m"add test file"
work/test git log
Author: gracenakano <>
work/test git push origin test
# pushes branch remotely
  • if we check our GitHub account, we should be able to see the new branch pushed up and merge it to our repository.




Fullstack Software Engineer | Musician | Food Lover | Coffee Addict

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Some Thoughts about Different Programming Paradigms

Python: How I Gained 30 Minutes a Day With This Robot Newsreader

How good is you CSS?

Must-Have Chrome Extensions

DApp Jedi 2020 ETHIndia Hackathon Challenge

How to send bulk emails for free

Top 14 Low-Code Application Development Start Ups by Everest Group

[Chapter 2] How to easily secure Web Application with HTTPS on Kubernetes.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Grace Yuiko Nakano

Grace Yuiko Nakano

Fullstack Software Engineer | Musician | Food Lover | Coffee Addict

More from Medium

Understanding How Remote Desktop Session Host Works

Task 30 Open-Shift industry use-cases

Information Architecture and User Flow — The Basics

How to copy ssh key to remote host using Ansible.