Say there's a large list of ssh public keys in ~/.ssh/authorized\_keys on a server with Git repositories, with a general format of " user@mail.com"

I want to write bash script for the pre-receive hook, that checks which SSH key was used to push the commit and then performs certain operations on the commit before it's received. So the outline of the script would be..

```
#!/bin/sh
#
<Check key which was used from authorized_keys for the commit>
<Print email corresponding to the SSH key to a file as a log>
<Do some other stuff here>

```

But since the server stores public keys, and private keys are used to push the commits, is it possible to check which key was used? If so how?

Sorry if I'm missing something obvious, just need some direction to get started.

Any help is appreciated, thanks.