Home > database >  two ssh keys for two different repositories are not working in config
two ssh keys for two different repositories are not working in config

Time:01-05

I just added a second ssh key in my .ssh folder on my mac to access the repo of my client.

The second repo I want to access is github.

I prepared my config file like:

Host github.com
IdentyFile ~/.ssh/id_github

Host xyz.*
IdentyFile ~/.ssh/id_xyz

Now I am able to access my clients repository, but not github anymore.

I also tried it with hostName entry but it did not work.

When I try ssh -vvv [email protected] I receive

OpenSSH_8.6p1, LibreSSL 2.8.3
debug1: Reading configuration data /Users/name/.ssh/config
debug1: /Users/name/.ssh/config line 1: Applying options for github.com
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/Users/name/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/Users/name/.ssh/known_hosts2'
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to github.com port 22.
debug1: Connection established.
debug1: identity file /Users/name/.ssh/id_ed25519 type 3
debug1: identity file /Users/name/.ssh/id_ed25519-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.6

But when I pull, nothing happen.

Can anybody help me?

Kind regards, nullpointer

CodePudding user response:

Your configuration has a typo. The configuration option is IdentityFile, and it needs to be used in conjunction with IdentitiesOnly.

How to configure this correctly can be seen in the Git FAQ.

CodePudding user response:

Well, I fixed it. After I found out that ssh -vT [email protected] established a connection and ssh [email protected] did not, I removed my vpn from my client and all worked fine. The problem was a running vpn.

Thanks

  •  Tags:  
  • Related