Skip to content

Instantly share code, notes, and snippets.

@jourdanrodrigues
Created May 18, 2024 21:46
Show Gist options
  • Save jourdanrodrigues/bcbb0305d8622d1c6ecfd7c8d6f307d5 to your computer and use it in GitHub Desktop.
Save jourdanrodrigues/bcbb0305d8622d1c6ecfd7c8d6f307d5 to your computer and use it in GitHub Desktop.
Use different SSH keys for different repositories based on host and email
Match host <repo host> exec "[ ! -z $(git config --local user.email) ] && [ $(git config --local user.email) = <work email> ]"
IdentityFile ~/.ssh/<work private file>
Host <repo host>
IdentityFile ~/.ssh/id_rsa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment