1

I have an ssh configuration file as follows:

Host github
   User git
   Hostname github.com
   IdentityFile ~/.ssh/id_rsa

Host github.com-work
   User git
   Hostname github.com
   IdentityFile ~/.ssh/work

I have access to all the (private) github repos and have added public keys already. But when I tried

ssh -T git@github.com-work

It throws this error:

ssh: Could not resolve hostname github.com-work: nodename nor servname provided, or not known

What could be the reason for this error?

Mary
  • 127
  • 1
  • 1
  • 8

1 Answers1

0

First, the idea behind adding User git in your ~/ssh/config file is to avoid using git@ in the SSH URL.

Second, check what config file is actually read with:

ssh -Tv github.com-work

As you can see here, it can depend on your OS, or the current user executing the ssh command.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250