SparkleShare with gitosis on ubuntu 10.10
Install gitosis on a server where you would like to backup/store documents.
On my debian 5.08 (lenny) server, gitosis may simply be installed via aptitude.
my-git-server:~$ sudo aptitude install gitosis
Now, standard “home-dir” for gitosis is /srv/gitosis. I would like to store my git-repositories on a raid location called /storage/. To change home-directory for gitosis, run this command: (Be sure not to create the new home folder gitosis).
my-git-server:~$ sudo usermod -m -d /storage/gitosis gitosis
-m tells usermod to copy over what is already installed in the current home folder for the user.
-d specifies the new home directory for the user.
Now we want to configure gitosis, and create our first repository.
As a regular user on the server, create a public key:
Standard rules apply, and no password is needed.
This key will be placed in your home folder: ~/.ssh/id_rsa.pub
It will be used to connect to our git server without having to authenticate.
Now we need to copy this key file to gitosis, to be able to clone the admin/config repository.
my-git-server:~$ sudo -H -u gitosis gitosis-init < ~/.ssh/id_rsa.pub
To edit/setup gitosis we need to clone the gitosis-admin repository. Do the following:
my-git-server:~$ git clone gitosis@my-git-server:gitosis-admin.git
When the repository is downloaded, we will edit the gitosis.conf file by using our favorite editor.
my-git-server:~$ nano gitosis-admin/gitosis.conf
writable = gitosis-admin
members = YOUR_SERVER_USER
writable = documents
members = YOUR_SERVER_USER
Append what is in between ##### to the file.
Basically, we have now defined a new group called users, with write access to repository documents.
Variable member should be matched with names according to the filename of the .pub file. (The filename shall be renamed to the username the user has on the computer that will access the repository. It should be understood that this user should execute ssh-keygen on that specific computer and send the .pub file to the server onto where the git server is installed.)
my-git-server:~$ cd gitosis-admin my-git-server:~/gitosis-admin$ cp id_rsa.pub keydir/YOUR_SERVER_USER.pub my-git-server:~/gitosis-admin$ git add . my-git-server:~/gitosis-admin$ git commit -a -m "Allow YOUR_SERVER_USER write access to repository documents" my-git-server:~/gitosis-admin$ git push
Creating a repository
writable = documents defines our new repository.
To populate this repository on the server we need to execute a couple of commands and push it to git.
my-git-server:~$ mkdir documents my-git-server:~$ cd documents my-git-server:~/documents$ git init my-git-server:~/documents$ git remote add origin gitosis@my-git-server:documents.git my-git-server:~/documents$ touch helloworld.txt my-git-server:~/documents$ git add helloworld.txt my-git-server:~/documents$ git commit -m "first test commit" my-git-server:~/documents$ git push origin master:refs/heads/master
Sparkleshare requires a few packages to be compiled. (Besides from build-essentials).
localhost:~$ sudo aptitude install gtk-sharp2 mono-devel monodevelop libndesk-dbus-glib1.0-cil-dev libndesk-dbus1.0-cil-dev python-nautilus
Download and untar sparkleshare-0.2-beta1.tar.gz
localhost:~$ wget https://github.com/downloads/hbons/SparkleShare/sparkleshare-0.2-beta1.tar.gz localhost:~$ tar -xvzf sparkleshare-0.2-beta1.tar.gz localhost:~$ cd sparkleshare-0.2-beta1 localhost:~/sparkleshare$ ./configure localhost:~/sparkleshare$ make && sudo make install
Install git, and clone repository to your local computer.
localhost:~$ sudo aptitude install git localhost:~$ git clone https://github.com/hbons/SparkleShare.git localhost:~$ cd SparkleShare localhost:~/SparkleShare$ ./configure localhost:~/SparkleShare$ make && sudo make install
Start sparkleshare from Applications->Internet->SparkleShare
Type in your name and e-mail address in the dialog that appears.
SparkleShare should now have created a public keygen that we need to upload to our server running gitosis.
From your home folder:
localhost:~$ cd .config/sparkleshare localhost:~/.config/sparkleshare$ scp firstname.lastname@example.org USERNAME@my-git-server:/home/USERNAME
Log onto your server, and rename email@example.com to firstname.lastname@example.org, or just remove @example.com.key.
Add the key to your git repository and edit gitosis-admin/gitosis.conf. Commit and push the changes.
my-git-server:~$ cd gitosis-admin my-git-server:~/gitosis-admin$ cp ~/email@example.com keydir/sparkleshare.user.pub my-git-server:~/gitosis-admin$ git add . my-git-server:~/gitosis-admin$ git commit -a -m "Allow sparkleshare.user write access to repository documents" my-git-server:~/gitosis-admin$ git push
New users that should have access to a repository, should be separated with a whitespace:
writable = documents
member = YOUR_SERVER_USER sparkleshare.USER
On your local computer, you should now be able to connect to your newly created repository by typing in the address to your server and the name of the git repository as written on the writable line (documents) in gitosis.conf file in the dialog box.
SparkleShare should now be working with your own git repository!