Getting started with 1Password for your growing team, or refining your setup? Our Secured Success quickstart guide is for you.
Forum Discussion
stonesbg
9 months agoNew Contributor
1Password SSH Agent how to set specific ssh key
I have a few different ssh keys that are used for git and would like to have it set so that if going through one github organization i force one key if going to a personal account it uses a different...
jc00ke
6 months agoOccasional Contributor
I've been able to achieve this with git's conditional includes. Here's what a config may look like:
# ~/.config/git/config
[include]
path = base-config.inc
[includeIf "hasconfig:remote.*.url:*:jc00ke/**"]
path = personal-config.inc
[includeIf "hasconfig:remote.*.url:*:WORK/**"]
path = work-config.inc
# ~/.config/git/personal-config.inc
[user]
name = Jesse Cooke
email = jesse@example.com
signingkey = ~/.ssh/personal.pubkey
# ~/.config/git/work-config.inc
[user]
name = Jesse Cooke
email = jesse@work.example.com
signingkey = ~/.ssh/work.pubkey
Here's my real dotfiles; this has worked for me for a while now.