Problem Statement
I have two different GitHub accounts: my work account and my personal account. I want to be able to contribute to my personal Quartz repository from my work laptop. To do this, I need to setup two separate GitHub accounts within my ssh/git configuration on my work local machine.
The Goal
- My work laptop uses
xxx.githubenterprise.comfor your work account.- I want to push to a private personal GitHub repo (Quartz) on
github.comwithout interfering with work Git.- I want my commits to be under my personal GitHub identity for the Quartz repo.
- I want to keep the Quartz repo private and editable from both devices.
The Solution
- First, generate a new SSH key pair on your work laptop for your personal GitHub.
ssh-keygen -t ed25519 -C "your_personal_email@example.com" # Save as: ~/.ssh/id_ed25519_personal - Then, add this key to your
~/.ssh/config.# ~/.ssh/config # Personal GitHub Host github.com-personal HostName github.com User git IdentityFile ~/.ssh/id_ed25519_personal IdentitiesOnly yes - Then add your public key (
~/.ssh/id_ed25519_personal.pub) to your personal GitHub account under: > GitHub → Settings → SSH and GPG Keys → New SSH Key - Clone the Quartz Repo Using the Custom Host.
git clone git@github.com-personal:yourusername/quartz.git ~/quartz cd ~/quartz - Configure Git Locally for the Quartz Repo
git config user.name "Your Name" git config user.email "your_personal_email@example.com" # verification within repo git config --get user.email git config --get user.name - Set Remote URL to Avoid Mistakes
git remote set-url origin git@github.com-personal:yourusername/quartz.git
Linked Map of Contexts