We have our own gitosis server running in our office server. We’ve typically used this to work on private projects. The problem with this setup is that there was not direct link between the office gitosis server with our repositories on github.

This problem has now been solved and we’re currently using our office gitosis server as a middle-layer repository. The gitosis server acts also as a downstream repository for our github repositories.

This can be easily done by logging into the gitosis server as the gitosis user and doing the following.

$ cd $HOME/repositories
$ git clone --bare [email protected]:aeste/sandbox.git

This will create a bare repository that can be pushed to and pulled from.

For existing repositories, the key would be to add the github repositories as upstream origin repositories.

$ cd $HOME/repositories/sandbox.git
$ git remote add origin [email protected]:aeste/sandbox.git

This will link our existing repository to the upstream repository on github.

After making local changes on our workstations and pushing them to our gitosis server, we can push the same changes upstream to github by:

$ cd $HOME/repositories/sandbox.git
$ git push -u origin master
$ git push -u origin develop

If there are changes on the github server, these can be pulled downstream to the gitosis server by:

$ cd $HOME/repositories/sandbox.git
$ git pull -u origin master
$ git pull -u origin develop

Synchronisation! This could even be automated.

The main advantage to new current setup is the speed at which we can clone the repository as we are no longer limited by the internet line at the office but are now limited by the computational speed of the gitosis server.

Leave a Reply

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