2

I guess I messed with my ssh configuration.

Lately I cannot clone a local repository anymore. It seems like the git repository is accepting both publickey and password but instead of letting me choose one of the two options it tries to connect using some wrong RSA-key resulting in the message:

Received disconnect from myRemoteComputer : Too many authentication failures for myUsername
fatal: Could not read from remote repository.

Same happens when I ssh to that computer

$ssh -v myRemoteComputerIP
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/myUsername/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Offering RSA public key: myUsername@cvg04
Received disconnect from myRemoteComputerIP: Too many authentication failures for myUsername

So something is going wrong, since lately both commands were working. I would basically need to tell ssh and git to use username and password instead of randomly choosing a wrong "RSA-key". Does anyone know how to repair this?

Also I executed some ssh-add command lately following some forum advice but maybe it's part of the problem...

3

Check your ~/.ssh/config. If you want to use password authentication, you can set it up just there like this:

Host myRemoteComputerIP
  PubkeyAuthentication no

It will never try public key authentication against this host.


How about when I have to connect with two different usernames once using a rsa key and an username / passwd authentification for the other?

You can use aliases in the ssh_config:

Host alias1
  Hostname myRemoteComputerIP
  PubkeyAuthentication no
  User user1
Host alias2
  Hostname myRemoteComputerIP
  # PubkeyAuthentication yes # is default
  User user2

and then connect using ssh alias1 and ssh alias2.

  • How about when I have to connect with two different usernames once using a rsa key and an username / passwd authentification for the other? – mcExchange Apr 20 '16 at 13:54
  • 1
    @mcExchange I edited the answer. – Jakuje Apr 20 '16 at 14:17
  • Hmm unfortunately this is not working out. Do I really put Host alias 1 for both users in ~/.ssh/config? Do I still call it with ssh user1@myRemoteComputerIP ? – mcExchange Apr 21 '16 at 8:40
  • Sorry. It was typo. alias2 of course. See my another edit. – Jakuje Apr 21 '16 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.