We have our server implementation of git repo. I would like to restrict push to the one of the branch of the repo for everyone except of me.
So, I added under .git/hooks/update
on server git dir such script
#!/bin/sh
if [ "$USER" != "Aleksey" ] && [ "$1" == refs/heads/test_br ];then
echo "Manual pushing to this repo is restricted"
exit 1
fi
And I see that condition "$USER" != "Aleksey"
is always true
. Second condition looks like is work good, but name condition not...
Who know what is the problem? Maybe I need to compare with user mail? Or something else?
Feel free to ask