105

I'm trying to create a .ssh/config file for multiple SSH accounts (specifically for github.com). I've tried several tutorials and github help walk-throughs but nothing seems to work.

I created a id_rsa_test and id_rsa_test.pub. I uploaded id_rsa_test.pub to github.

I then created a ~/.ssh/config file with the following:

# github account
Host github.com-test github.com
    Hostname github.com
    User git 
    IdentifyFile ~/.ssh/id_rsa_test

and

# github account
Host github.com-test github.com
    Hostname github.com
    User git 
    IdentifyFile ~/.ssh/id_rsa_test.pub

I then try several commands. i.e.:

git clone git@github-test:username/my_project.git

git push

...everytime I get the following error:

/home/username/.ssh/config: line 5: Bad configuration option: IdentifyFile
/home/username/.ssh/config: terminating, 1 bad configuration options
fatal: The remote end hung up unexpectedly

Any suggestions?

tom
  • 21,844
  • 6
  • 43
  • 36
Rico
  • 5,692
  • 8
  • 46
  • 63
  • 1
    YOUR AMAZING! The one thing I forgot was the **IdentityFile ~/.ssh/id_rsa_test.pub** thank you! **EVERYONE** don't forget the **.pub** as well. – wesley franks Jul 28 '16 at 03:44
  • @wesleyfranks No, there must **not** be a ".pub" suffix in the IdentityFile line (that results in one of the following errors: *"WARNING: UNPROTECTED PRIVATE KEY FILE!"*, or *"Load key "xxx.pub": invalid format"*). – tom Dec 07 '21 at 07:30
  • 1
    DONT ADD .PUB See https://stackoverflow.com/a/48330113/8333806 – abdoulsn Feb 13 '23 at 14:56

1 Answers1

306

It is IdentityFile with a 't', not IdentifyFile.

tom
  • 21,844
  • 6
  • 43
  • 36