You can add a post-receive hook to the ~/bar.com.git repo for this. To do this add to the ~/bar.com.git/hooks/ directory an executable file post-receive with the content:
#!/bin/sh
unset $(git rev-parse --local-env-vars)
cd ~/bar.com
git pull
Make sure the post-receive file has the executable bits(e.g. 755).
Now whenever something is pushed to the ~/bar.com.git repo, the ~/bar.com repo is updated automatically.
See also
- getting “fatal: not a git repository: ‘.'” when using post-update hook to execute ‘git pull’ on another repo
- Git – post-receive hook with git pull “Failed to find a valid git directory”
to understand why unsetting some environment variables is necessary.