0

Having some issues with maintaining too many SSH keys in the same computer lately.

  • I have created two SSH keys in my computer for UserA(Company) and UserB(Personal). Both the ID's are created using different email ID
  • I am able to pull and push the code changes for UserA

But UserB is where I face trouble to push my code.

  • I am able to pull the code for UserB(Where repo is different than UserA)
  • While pushing the code I get the following error

    ERROR: Permission to UserB/xxxxxx.git denied to UserA.

    Please make sure you have the correct access rights
    and the repository exists. ```
    

Feel bit strange to me. Can someone help me this ?

Perseus
  • 1,546
  • 4
  • 30
  • 55
  • 1
    The answers for github and gitlab are (at least potentially) different here - pick one tag, not both! – torek Dec 17 '19 at 07:47
  • Does this answer your question? [Best way to use multiple SSH private keys on one client](https://stackoverflow.com/questions/2419566/best-way-to-use-multiple-ssh-private-keys-on-one-client) – Arty-chan Jan 19 '20 at 20:08

3 Answers3

0

Starting from Git 2.3.0 you can use below command

GIT_SSH_COMMAND='ssh -i private_key_file' git clone user@host:repo.git
Jithin Babu
  • 79
  • 1
  • 7
0

Solved !!

Created Gitconfig for personal and work using the following link,

https://medium.com/@trionkidnapper/ssh-keys-with-multiple-github-accounts-c67db56f191e

Perseus
  • 1,546
  • 4
  • 30
  • 55
0

Sometimes you have the problem of too many keys stored in the ssh-agent.
Then the server refuses the connection after it offering too many keys.

This can be solved by force ssh to use only one specific key.

GIT_SSH_COMMAND='ssh -o IdentityAgent=none -i private_key_file' git <cmd>
jeb
  • 78,592
  • 17
  • 171
  • 225