Created
May 18, 2024 21:46
-
-
Save jourdanrodrigues/bcbb0305d8622d1c6ecfd7c8d6f307d5 to your computer and use it in GitHub Desktop.
Use different SSH keys for different repositories based on host and email
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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