How does SSH know which key to use?

Solution 1:

I also found the -v option while connecting and it shows what it's doing. Turns out, it tries a bunch of keys that it finds in the .ssh dir. Basically tries whatever's in there.

Solution 2:

There is an option called "IdentityFile"...

I suggest reading a little bit about ssh.config. It is worth it. You can configure the key, port, user name...