Give preference to 1p ssh key defined in git config
Hello.
I have multiple github accounts that I need to use at the same time. All my ssh keys are stored in 1p. what I need is when operating under one git repo, to always use the preferred GithubAuth key in that repo as opposed others that may be defined in a different order in the 1p toml file.
For example:
when working under /git-repo1/ (use GithubKey1)
when working under /git-repo2/ (use GithubKey2)
when working under /git-repo3/ (use GithubKey3)
what i'm finding is that even if i have an identity file defined in the gitconfig, 1p still goes through the list of ssh keys defined in my ssh vault and doesn't give preference to the one defined in the gitconfig.
# git-repo3 config [core] sshCommand = "ssh -i ~/.ssh/GitHubKey3.pub"
Using a 1p toml configuration doesn't really help since I can't really specify folders, only the ordering, which helps somewhat but what I need is to give it preference to the key defined in my git config when pulling/pushing git changes.
Does anybody know a way where I can have 1p give preference to keys defined in the gitconfig for each repo?
1Password Version: Not Provided
Extension Version: Not Provided
OS Version: Not Provided
Browser: Not Provided
Comments
-
what i'm finding is that even if i have an identity file defined in the gitconfig, 1p still goes through the list of ssh keys defined in my ssh vault and doesn't give preference to the one defined in the gitconfig.
When you configure the identity file, you should be able to specify the public SSH key to use, with the private key stored in 1Password. In this case, when the identify file is used for SSH access, only that key will be attempted.
In order to get this behavior to work you may also need to specify the
IdentitiesOnly
option in~/.ssh/config
.0