Friday, May 30, 2014

Set up of Gitosis

Gitosis:

Gitosis is basically a set of scripts that help you manage the authorized_key file as well as implement some simple access controls.

Installing:

Gitosis requires some Python tools, so first you have to install the Python setuptools package, which Ubuntu provides as python-setuptools

sudo apt-get install python-setuptools

Next, you clone and install Gitosis from the project’s main site:

git clone git@path_of_project.git

cd gitosis
sudo python setup.py install

That installs a couple of executables that Gitosis will use. Next, Gitosis wants to put its repositories under /home/git , which is fine. But you have already set up your repositories in /opt/git , so instead of reconfiguring everything, you create a symlink:

ln -s /opt/git /home/git/repositories

Gitosis is going to manage your keys for you, so you need to remove the current file,
re-add the keys later, and let Gitosis control the authorised_keys file automatically. For now,
move the authorised_keys file out of the way:

mv /home/git/.ssh/authorized_keys /home/git/.ssh/ak.bk

You need to turn your shell back on for the “git” user, if you changed it to the git-shell command. People still won’t be able to log in, but Gitosis will control that for you. So, change
this line in your /etc/password file

git:x:1000:1000::/home/git:/usr/bin/git-shell

back to

git:x:1000:1000::/home/git:/bin/sh

Now initialised it with gitosis init where we want to initalised.

Now this is set up

No comments:

Post a Comment