You should add and commit your user files first in your hook:
git --work-tree=~/public_html --git-dir=~/root.git add -- path/to/userfile
git commit -m "add user file"
Here, path/to/userfile
is a relative path, relative to ~/public_html
which is the root folder of the working tree.
Then you can go on and checkout the all repo:
git -c 'core.bare=false' --work-tree=~/public_html --git-dir=~/root.git checkout -f
The -c 'core.bare=false'
allows to override the config core.bare
of the bare repo, in order to allow git add
to proceed, considering ~/public_html
as its working tree.
If the '-c' option does not work (because the OP uses git 1.7.1 - released in Dec. 2010!), try first (if upgrading git is not an option) to change the setting, then restore it:
git --git-dir=~/root.git config core.bare false
git --work-tree=~/public_html --git-dir=~/root.git add -- path/to/userfile
git --git-dir=~/root.git config core.bare true
Note that this is a strange practice, since it makes a git push result in a branch with an extra commit. Don't forget to git pull just after the git push, in order to get that new commit.