Score:1

Why is SSH key for specific Host not used before catch-all?

cn flag

I'm trying to connect to Github (on a Mac) using a specific SSH key. When my .ssh/config file looks like this:

Host github.priv.com
  HostName github.com
  UseKeyChain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_gh_priv

Host *
  UseKeyChain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_rsa

it uses id_rsa when I run ssh -T [email protected], but when I use a specific host:

Host github.priv.com
  HostName github.com
  UseKeyChain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_gh_priv

Host github.com
  UseKeyChain yes
  AddKeysToAgent yes
  IdentityFile ~/.ssh/id_rsa

it uses id_gh_priv when I run ssh -T [email protected].

What am I missing? I thought it's supposed to use the first config that matches.

NOTE: both keys are in the OSX keychain.

cn flag
My current workaround is to add an additional ssh key with a separate config for `github.com` ``` Host github.com UseKeyChain yes AddKeysToAgent yes IdentityFile ~/.ssh/id_gh_default ```
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.