Git post-receive hook for website sync
Shell
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README
website-pull
website-sync

README

website-sync
============

Scripts used to hook into post-receive chain of gitolite, such that when an
authorised user pushes certain branches to the repository, the content is
synced to a (remote) webhost.

website-sync is invoked on the gitolite host, by the post-receive hook

website-pull is invoked on the webserver host, via SSH from website-sync

Assumptions
-----------
1) ~/.ssh/config of the gitolite user is setup to forward SSH connections to
   'webhost' to the correct server.

2) website-pull is setup in ~/.ssh/authorized_keys to be invoked whenever an
   incoming SSH connection with the relevant SSH key is received (as it uses
   SSH_ORIGINAL_COMMAND to retrieve the arguments).

3) that an executable script exists on the webserver host relative to the
   login path, with the name of the repository. This will likely need to do:
   $ git fetch -q --all
   $ git --bare update-server-info
   $ export GIT_WORK_TREE=/srv/...
   $ git reset -q --hard $branch
   $ git checkout -qf $branch

4) Git repo's on the webhost have been mirror-cloned using:
   git clone --mirror <remote git url>