When a user connect over SSH with public key, how did Github detect which user it is?
ssh -T git@github.com
Hi **Ben**! You've successfully authenticated, but GitHub does not provide shell access.
How to implement such a feature, especially consider that the user info is in some database like MySQL?
I'm fairly certain this is done using a centralized authorized_keys file along with the command option. Check out the AUTHORIZED_KEYS FILE FORMAT section of the man page.