I am assuming everyone is sharing the same user on the git server, and they each have their own key to log in with.
If that is the case, then instead of identifying the remote user, you could easily identify the public key that the user used to log into the git server. To do that, you should allow
PermitUserEnvironment in your server's
sshd_config, and then you can easily identify each public key by prefixing it with something like
environment="GIT_USER=username". For example, the
authorized_keys file for the git serve user could look like this:
environment="GIT_USER=bob" ssh-rsa AAA.....abc== bob@somehost
environment="GIT_USER=sam" ssh-rsa AAA.....def== sam@otherhost
You are free to choose the environment variable name and user identifier.
If you are using gitolite, then
$GL_USER is what you are looking for.
If you are using gitosis, you should consider switching to gitolite.