Well i have seen two of the variant , one in ruby , other in perl.Here is mine in simple shell script.
First you need to install uvccapture,
sudo apt-get install uvccapture
then, copy this code inside your post_update commit hook and it will do the job just as well.
mkdir -p ~/.gitpix && uvccapture -m -x640 -y480 -o$HOME/.gitpix/pic-$(date +%s).jpg