How to Use Company & Personal GitHub Accounts on One Machine (SSH Config)

Опубликовано: 22 Май 2026
на канале: Code with Ganesh
7
0

In this video, I walk you through the exact .ssh/config setup you need to manage both a Company GitHub account and a Personal GitHub account on the same computer.
We will cover the following steps:
1. Generating Unique SSH Keys: We start by running ssh-keygen to create distinct keys for your accounts, saved specifically as ~/.ssh/id_ed25519_company and ~/.ssh/id_ed25519_personal,.
2. Activating the Keys: Learn how to add both keys to your SSH agent and copy the public keys into your GitHub → Settings → SSH & GPG Keys.
3. Configuring the .ssh/config File: I will show you how to edit your config file to define specific aliases. We will set up Host github-company and Host github-personal, linking them to their respective IdentityFile paths to ensure the correct key is always used,.
4. Cloning and Switching Repositories: Finally, we demonstrate how to clone repositories using the new aliases (e.g., git clone git@github-company:USERNAME/REPO.git) and how to switch the remote URL of existing repos to point to the correct account.
Commands Used:
• ssh-keygen -t ed25519 -C "[email protected]"
• ssh-add ~/.ssh/id_ed25519_company
• git remote set-url origin git@github-personal:USERNAME/REPO.git