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...
2 Answers
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.
Clone using https and it will always ask for password.