-
Create ssh config:
# Github: user1 Host github.com HostName github.com IdentityFile ~/.ssh/user1 IdentitiesOnly yes # Github: user2 Host github.user2 HostName github.com IdentityFile ~/.ssh/user1 IdentitiesOnly yes -
Generate SSH key pairs:
ssh-keygen -t ed25519 -C "user1@gmail.com" -N Password -f .ssh/user1ssh-keygen -t ed25519 -C "user2@gmail.com" -N Password -f .ssh/user2 -
Edit .ssh/config file (just copy over)
-
Add ssh keys to system:
ssh-add user1ssh-add user2 -
Test connection:
ssh -T git@github.comssh -T git@github.user2 -
Install git cli: https://github.com/cli/cli
-
gh auth login and choose ssh method to authenticate your git accounts.