Git

Introduction

Git is a tool that enables collaboration. Several users of Bibledit will all connect to the same Git repository, and so share the data. If somebody makes a change, within a short time that change will propagate to the other users.

Git can be used if two or more different users, using different computers, simultaneously work with Bibledit on the same data.

Git version 1.5.0 or higher is needed.

In the example below we will setup a basic system using one server and two users.

Server

Collaboration using Git needs one computer that will be the server. This can be a separate computer, or the computer of one of the users. In this example we will use the computer of one of the users. By doing so we only need two computers to demonstrate everything. We will use Jim's computer to serve the repository.

On this computer, do the following to setup the server.

Login as user jim.

Open a terminal

We will create an shared repository in /home/jim/git/repository, and fetch the data of Jim's project "Ndebele" into it. To do that, type

mkdir -p /home/jim/git/repository
cd /home/jim/git/repository
git --bare init-db --shared
git --bare fetch /home/jim/.bibledit/projects/Ndebele/data master:master

To make the repository available to the network, type

git-daemon --export-all --base-path=/home/jim/git --detach --enable=receive-pack

It is recommended to put the command that starts the daemon in the boot script.

To test access to the new repository, type

git-ls-remote git://localhost/repository

If everthing is fine, no errors will occur and a few commits will be listed.

First user

We are now going to setup the first user. This will be Jim in our example. His computer already is used as a server, but Jim also works on it using Bibledit.

Jim starts Bibledit, and opens the project he wishes to share with others.

He goes to menu Preferences / Git repository.

In that dialog, he ticks "Use remote repository".

Under "Repository", he enters git://localhost/repository

In the dialog he verifies that write access has been granted.

He then ticks "Synchronize local data with repository".

He then clicks OK.

This finishes the setup of the first user. Jim can now work on Bibledit as before, and his data will be automatically updated in the repository.

Second user

We are now going to setup the second user. This will be John in our example. He uses another workstation, is connected to the network, and can access Jim's computer through that network.

John starts Bibledit, and creates a new empty project, named after the project that Jim put in the repository.

He goes to menu Preferences / Git repository.

In that dialog, he ticks "Ue remote repository".

Under "Repository", he needs to enter the name of Jim's server.

He asks Jim for the IP address of his computer. Jim logs in as root, and types ifconfig, notices under "eth0" that his computer has IP address 192.168.0.6. He passes this number on to John.

Under "Repository", John enters git://192.168.0.6/repository

In the dialog he verifies that write access has been granted.

He then ticks "Copy repository to local data". This is to import all data from the repository into his own project.

He then clicks OK.

This finishes the setup of the second user. John can now work on Bibledit as before, and his data will be automatically updated in the repository.

Setting up a third user, a fourth, and so on, goes exactly the same.

Collaborating

Now we come to the purpose of everything, which is working together on one project.

This collaboration is very simple: Just work on your data as you did before.

Bibledit cares for everything, and everything will be updated and shared automatically.

On rare occasions you might notice a dialog when Bibledit says that it has reloaded the project because of the changes made by other users. This might happen if the change is in the chapter you are now editing. But this is really all that is visible, the rest is done automatically. And of course, you notice changes in your data that you didn't put in yourself. Others did that.

Notes

Use dialog View / Git tasks to see what it actually does. Most of the times there should be no pending tasks anyway, because tasks will get done immediately. On a slow network you might see some tasks pending. Or if you happen to be offline, tasks will accumulate till such time that you get online again.

For worldwide collaboration, a server can be set up on the internet, and used by all parties. Instead of entering git://192.168.0.6/repository or git://localhost/repository as the repository, for example, it will be something like git://repo.mydomain.org/repository.

Git can conveniently be used for automatic backup. The git repository can be put on a USB stick, and carried around. If the user inserts the stick in the computer, and runs Bibledit with git and a remote repository pointing to that USB stick, then as soon as there is a change, it will be written to that repository. It is helpful to put a label on the stick using program e2label, so that when the stick is inserted, it gives a defined mounting point. The stick must be made writable when inserted.