- Make a
--bare --mirror
clone 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
config
into/var/git/some-site.git/config
(don't overwrite) - Use
git add-deployed
to 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-mirror
andupdate-deployed
for your repo, e.g.
GIT_DIR=/var/git/some-site.git $(which git) update-mirror
to update your mirrored repo.GIT_DIR=/var/git/some-site.git $(which git) update-deployed
to update your deployed branchesGIT_DIR=/var/git/some-site.git $(which git) update-all
to 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.