(for example work and personal)
Using the same ssh key usually would not work, because you're likely to use different emails for your work and personal accounts.
Internet is full of suggestions of configuring different host in ~/.ssh/config, which certainly would work, however I like the following more:
1. Generate a new SSH key
ssh-keygen -t ed25519 -C "your@email.com" -f ~/.ssh/id_ed25519_work
2. Configure your repo to use specific SSH key:
git config --add --local core.sshCommand 'ssh -i <<path to your private ssh key>>'
path to the private key could be /Users/username/.ssh/id_ed25519_home
No comments:
Post a Comment