Gollum – Auto sync to git remote repository

Update @ 2015-09-23: Frank suggested using incron to execute the sync base on file changes instead of time periods. Thanks!.

Whenever you have edited any page on Gollum, it will committed to the local repository which is checked out on the server. These commits WILL NOT be pushed to the Git Server. Similarly any push to the Git server will not sync to the repository running Gollum as it won’t execute git pull neither.

You may think of using the Git post-commit hook to trigger the synchronization whenever a commit is done but Gollum run Grit as the Git adapter and Grit doesn’t support hook.

A workaround suggested by Rod Hilton is to setup a cronjob and keep running the git push and pull on the server running Gollum.

So add the following sync.sh to your Gollum project root.
sync.sh

#!/bin/sh

DIR="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
(cd $DIR && git pull && git push)

 

Then setup the crontab to run the sync.sh every minute.

*/1 * * * * /<gollum_root>/sync.sh

 

Done =)

Reference: Absolutely No Machete Juggling – Personal Wiki using GitHub and Gollum on OS X

Advertisement

2 thoughts on “Gollum – Auto sync to git remote repository”

  1. have a look at incron, it can trigger when a file change is detected and run a script,
    would help with the push part

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.