Forum Discussion

trinkel's avatar
trinkel
New Contributor
2 months ago

1Password doesn't select public key configured in SSH config

I have two GitHub accounts and have set up my `~/.ssh/config` file per https://developer.1password.com/docs/ssh/agent/advanced#use-multiple-github-accounts. I had this set up before I started using 1Password and it has worked from the command line to differentiate between the SSH keys for my two accounts.

The configuration is set up to use my default public key for my personal GitHub account and a different key is specified for my work account by:

Host github.com-davies HostName github.com IdentityFile ~/.ssh/<pubkeyfilename></pubkeyfilename>

NB: I added "IdentitiesOnly yes" per your documentation, but from the command line I got the error "Bad configuration option: identitesonly" so I have removed it. The key has worked from the command line without it.

1Password works fine with VSCode and command line accessing my personal GitHub account using the default public key. However, when I try accessing my work GitHub account, the 1Password prompt accesses the default key rather than the key for my work account. (It has been awhile since I have accessed my work GitHub account so I don't remember if it ever worked with 1Password). If I disable 1Password in ~/.ssh/config, SSH accesses the correct public key.

My Git remote repository is configured as: 

remote.origin.url=git@github.com-davies:timrinkel/

Currently, the only way to access my work account is to disable 1Password and to type in the passphrase when prompted. For the record, there are other configurations, not related to GitHub or 1Password in ~/.ssh/config.

MacOS: 13.7.6
1Password for Mac 8.11.1 (81101001)

1 Reply

  • trinkel's avatar
    trinkel
    New Contributor

    Add a little more info . . .

    If I do

    git remote show origin

    from a command line in the work repository, I get the popup from 1Password to use my default public key. If I accept it, I get a couldn't read repository error. If I deny or escape out, I then get a prompt to enter the passphrase for my work public key. After entering the passphrase, the git command responds as expected.

    The situation is similar when using the Git interface in VSCode.