Sunday, March 24, 2013

Installing Git and Gitolite on a Raspberry PI

If you want to give a try to Git @home (and are not interested by GitHub), installing Gitolite on a Raspberry PI is one of the best option you have, even better than installing git on a Synology NAS (in the case you do not want to tweak your Synology device).
A Raspberry PI in a plastic case.

All you have to do is to:
  • order a Raspberry PI model B (less than € 35) and some accessories. Here you have a list of compatible items you can use with a PI. Additionally to my PI, I bought :
    • an USB power supply (~ € 7-12. Beware; output must be at least 1A)
    • a clear moulded plastic case to house the PI  (~ € 6)
    • a Transcend TS32GSDHC10E  32 GB SDHC class 10 memory card (~ € 24. Could be less sized. Initially I wanted to have enough space to host an artifacts repository)
    • an Edimax EW-7811UN USB Nano adapter Wireless 150 Mbps (~ 12 €. required only if you want to place your PI out of reach of an Ethernet plug)
  • allow ssh access to your PI (gitolite or not, this is something you will do during the first setup under Raspbian Wheezy ...)
  • install git and perl on your PI using the usual apt-get install commands
  • useradd a git account
  • follow the installation instructions of Gitolite as you can found them on the GitHub repository. 
Gitolite enables you to setup a server of  git repositories on a dedicated host. Access control is based on user's public SSH keys, and access to each repository can be controlled per user or group of users.

There is no need for a GUI to administrate a Gitolite server; a particular git repository, gitolite-admin (that you have to clone on your workstation as any other repository) is used to create and configure repositories, and to grant rights to users.

The initial conf/gitolite.conf file of the gitolite-admin project gives at the first sight an idea of the main principle of gitolite:

repo gitolite-admin
    RW+     =   bob

repo testing
    RW+     =   @all

You are bob, you have installed gitolite on the PI (and as you give your public key bob.pub  during installation, your are granted to administrate the gitolite-admin repository). Every known user (@all) is granted to use git-fully the repository testing.

If you want to add a new repository named myrepo1 to your gitolite server, you just have to clone the gitolite-admin repository on your development workstation, and add the following lines to conf/gitolite.conf:

repo myrepo1
    RW+     =   bob
    R       =   alice

Alice being a new "read only" player, you also have to add her public key named alice.pub into the keydir directory of the gitolite-admin project.

Add, commit, and push; et voilà ! Your new repository myrepo1 is  clonable by Bob and Alice.

Instructions for deleting a repository can be found here.

Even if you do not use your Synology device to host a git server, you can still use it to backup your Raspberry's Gitolite repositories with rsync. This is another story ...




References:



No comments:

Post a Comment

Please, enter your comments bellow