Last active
April 21, 2022 12:08
-
-
Save Daenyth/f7bd4d7c9325f046322ad99924fa7453 to your computer and use it in GitHub Desktop.
Use a different ssh key for a specific github organization
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
# ~/.ssh/config | |
Match host github.com exec "[[ $(git remote get-url origin | sed 's/^.*://' | sed 's/\/.*//') = TheGithubOrganization ]]" | |
# Don't forget to ssh-add this in addition to other keys, or git will pick one that's already in the agent first | |
IdentityFile ~/.ssh/specific_rsa |
You're right - the answer on stack overflow linked above using gitconfig handles that though
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice but I assume this wont handle
git clone
?