onsdag 25 januari 2012

Gitosis

Adapted from http://blog.agdunn.net/?p=277


pacman -S git-core setuptools
useradd --home-dir=/media/STORAGE/git --create-home --system git
su -l git

git clone git://eagain.net/gitosis.git
cd ~/gitosis
patch gitosis/ssh.py <<EOF
37c37
<     TEMPLATE=('command="gitosis-serve %(user)s",no-port-forwarding,'
---
>     TEMPLATE=('command=".local/bin/gitosis-serve %(user)s",no-port-forwarding,'
EOF
patch gitosis/templates/admin/hooks/post-update <<EOF
3c3
< gitosis-run-hook post-update
---
> ~/.local/bin/gitosis-run-hook post-update
EOF
git commit -a -m 'Adapt Gitosis for being installed with python setup.py install --user' --author 'Lars Rasmusson <Lars.Rasmusson@gmail.com>'
python2.7 setup.py install --user

~/.local/bin/gitosis-init  
[ paste your public ssh key and press CTRL-D ]

chmod u+x ~/repositories/gitosis-admin.git/hooks/post-update

Now you can clone the repository gitosis-admin.git from the server using

git clone git@servername:gitosis-admin.git


To add a user with pubkey file username.pub


cp username.pub gitosis-admin/keydir/
(cd gitosis-admin; git commit keydir -m 'added user'; git push)

To give the user access to a repository, add him to a group
(or create a new group for him), and add the repository name
to the ‘writable’ list for that group in gitosis-admin/gitosis.conf



Inga kommentarer:

Skicka en kommentar