gitosis is a nice program for hosting git repositories without having to give regular access to users. Using SSH under the covers, it basically acts as a special shell, thus limiting access to git. There are a number of nice tutorials available that explain how to make things work. I particularly liked this one. However, there is a lot of manual steps involved and a lot of errors can happen. I have therefore spent some time and started writing a few shell scripts that provide a more comfortable interface. At the moment the following scripts exist:
- gitosis-init.sh : Initializes gitosis and “installs” a regular user (not git or gitosis) for further admin work. This needs to be executed locally on the machine that runs gitosis. In order to avoid password hazzle, it is recommended to run it as root. Alternatively you can run it as the gitosis user. However, this mode has not been tested well so far. Any feedback is highly welcome.
- gitosis-add-repo.sh : Puts an existing local git repository into a remote gitosis repository.
The following scripts are currently planned for the future (other ideas are welcome!):
- Add user to gitosis (copy SSH public key over)
- Add user to repo (read/write access)
Please note that the scripts were written on Debian Lenny (v5) and so far only tested on this system. For more detailed instructions please check out the man pages (also included in the scripts).
[Update 2010-01-03: You may also want to check on gitolite, which is a gitosis rewrite in Perl with far more granular access control.]
2 thoughts on “Scripts for gitosis”
I was unable to clone the admin directory until I did a permissions fix on .ssh and the contents. They will be ignored if they are group or other writable. Don’t know why the perms were set that way.
Thanks for the hint, I will add a check for the permissions