You need to restrict push to certain branches. To do this in hook Gita need to determine which user was connected. All connected via the same user using ssh keys. To determine the user needs to obtain his public key, to it user and save in a variable environment. The mechanism is clear, I do not understand how to sshrc's to get the public key for the current connection, man read, but not found. upd
Found this option, but couldn't convert. Have read man sshd, authorized_keys to have the opportunity to add environment settings using environment="NAME=value", which is basically me, but the problem is not being able to run, if you write after the public key, the variable is not set if before, then the authorization key occurs.
these are the options I used:
environment="GIT_USER=deployer" ssh-rsa AAAA....... user@computer
ssh-rsa AAAA....... user@computer environment="GIT_USER=deployer"