Fill these in once
- Create a second key just for this account
ssh-keygen -t ed25519 -C "you@work.com" -f ~/.ssh/id_ed25519_work - Give it its own short name in your SSH settings
cat >> ~/.ssh/config <<'EOF' Host github-work HostName github.com User git IdentityFile ~/.ssh/id_ed25519_work IdentitiesOnly yes EOF - Copy the public key and add it to the second account
pbcopy < ~/.ssh/id_ed25519_work.pub open https://github.com/settings/ssh/newMake sure you're logged in to the second account in the browser.
- Clone using the short name instead of github.com
git clone git@github-work:company/project.git - Use the work email for commits in that repo
git -C "$(basename company/project)" config user.email "you@work.com"
Check it worked
- Check GitHub sees the second account
ssh -T git@github-workIt should greet you with the second account's username.
- Create a second key just for this account
ssh-keygen -t ed25519 -C "you@work.com" -f ~/.ssh/id_ed25519_work - Give it its own short name in your SSH settings
cat >> ~/.ssh/config <<'EOF' Host github-work HostName github.com User git IdentityFile ~/.ssh/id_ed25519_work IdentitiesOnly yes EOF - Show the public key, then add it to the second account
cat ~/.ssh/id_ed25519_work.pub xdg-open https://github.com/settings/ssh/newMake sure you're logged in to the second account in the browser.
- Clone using the short name instead of github.com
git clone git@github-work:company/project.git - Use the work email for commits in that repo
git -C "$(basename company/project)" config user.email "you@work.com"
Check it worked
- Check GitHub sees the second account
ssh -T git@github-workIt should greet you with the second account's username.
- Create a second key just for this account
ssh-keygen -t ed25519 -C "you@work.com" -f "$env:USERPROFILE\.ssh\id_ed25519_work" - Give it its own short name in your SSH settings
Add-Content "$env:USERPROFILE\.ssh\config" @" Host github-work HostName github.com User git IdentityFile ~/.ssh/id_ed25519_work IdentitiesOnly yes "@ - Copy the public key and add it to the second account
Get-Content "$env:USERPROFILE\.ssh\id_ed25519_work.pub" | Set-Clipboard Start-Process "https://github.com/settings/ssh/new"Make sure you're logged in to the second account in the browser.
- Clone using the short name instead of github.com
git clone git@github-work:company/project.git - Use the work email for commits in that repo
git -C (Split-Path "company/project" -Leaf) config user.email "you@work.com"
Check it worked
- Check GitHub sees the second account
ssh -T git@github-workIt should greet you with the second account's username.