- Make a
--bare --mirrorclone in some central location on the server, e.g./var/git/some-site.git - Clone from that central location into your deployment paths, e.g.
git clone /var/git/some-site.git /var/www/some-site.com/- Check out the correct branch and setup tracking and all that usual stuff...
- Add the contents of
configinto/var/git/some-site.git/config(don't overwrite) - Use
git add-deployedto tell the central repo where your deployments are, e.g.
git add-deployed master /var/www/some-site.com/
- Setup a cron or a hook that triggers
update-mirrorandupdate-deployedfor your repo, e.g.
GIT_DIR=/var/git/some-site.git $(which git) update-mirrorto update your mirrored repo.GIT_DIR=/var/git/some-site.git $(which git) update-deployedto update your deployed branchesGIT_DIR=/var/git/some-site.git $(which git) update-allto get 'em both
- For bonus points, use multiple repos and update them all in one pass:
for repo in /var/git/*.git; do $(which git) --git-dir=$repo update-all; done
Just remember that the order of the "deploy.branch" config is "$branch $path" and you'll be fine.