This is an old revision of the document!
Table of Contents
Arcoslab-doc configuration
We have a lot o photos and binary files inside our documents git repository, so this is an effort for bringing them out of control-versioning and into our owncloud service. We can do that with git hooks, so that we make sure that the owncloud and the git repo stay synced.
Testing hooks branch
We don't want to make important changes to master (because that is usually a bad idea), so we have created a branch for testing this new feature. If you want to test this yourself, or want to contribute, do so on the special branch.
Inside the arcoslab-doc repo run:
git checkout hooks-testing git pull
DO NOT merge this special branch to master, unless you know the dark magic of git very well. This can be very dangerous and break the workflow of many ARCOS-Lab members. You have been awared!
Syncing the repository with owncloud
As said before we realy want to take out the pictures from the repository, because in general it is a bad idea to manage binary files with git. So what we are doing is moving the pictures directory out of the repository and upload them to our internal owncloud service.
In order to achieve that we need a methos for syncing the repo and owncloud, so that whenever you execute a git pull you can also download the pictures from the owncloud. And also, that whenever you execute a git push any new photos are uploaded to the owncloud. It should also be possible and easy for anyone to sync their owncloud without having to execute git commands.
We are going to achieve this with git hooks. This are scripts that are executed when the user executes some special git commands. In out case we will use the pre-push and post-merge hooks. The first one is used to upload changes to owncloud, and the second one to download.
We are taking the pictures directory out of the repo, so we need a method to determine when there has been an update in this external directory, so that we can
Install the owncloud client
sudo apt install owncloud-client
Also configure arcoslab-doc to use our custom hooks
cd <arcoslab-doc repo> git config core.hooksPath .githooks git pull