Skip to main content

A basic Django app for using Gitolite

Project description

# Django Gitolite

A basic Django app for using Gitolite

## Configuration

By default the Gitolite rc file is `~/.gitolite.rc`. Follow these steps:

1. Add `LOCAL_CODE => "$ENV{HOME}/local",` to the rc file.
2. Create `~/local/triggers/post-compile/django`, it should be executable and
call the `gitolitetrigger` management command.
3. Create `~/local/hooks/common/post-receive`, it should be executable and call
the `gitolitehook` management command.
4. Add `POST_COMPILE => ['post-compile/django'],` to the rc file.
5. Add `POST_CREATE => ['post-compile/django'],` to the rc file.
6. Add `SSH_AUTHKEYS => ['post-compile/ssh-authkeys'],` to the rc file.

This is an example `post-compile/django` script:

#!/bin/bash
source ~/virtualenv/bin/activate
export PYTHONPATH=~/site
export DJANGO_SETTINGS_MODULE=settings
python ~/site/manage.py gitolitetrigger $@

This is an example `post-receive` script:

#!/bin/bash
source ~/virtualenv/bin/activate
export PYTHONPATH=~/site
export DJANGO_SETTINGS_MODULE=settings
python ~/site/manage.py gitolitehook $@

### Running as another user

This configuration requires `sudo` and the current user to be in the same group
as the gitolite user's default group.

As the gitolite user, open `~/.gitolite.rc` and add `UMASK => 0027,`. This is
required to be able to read `gl-creator` and `gl-forked-from` files in the
repositories. Next, ensure that the key directory, `~/.gitolite/keydir` exists
and is writable by the current user. Files in this directory need to be
readable by the gitolite user, to ensure that files are created belong to the
gitolite user's default group use `chmod g+rwxs ~/.gitolite/keydir`.

Next, you need to setup `sudo` so the gitolite user can use it to run Gitolite
triggers. Insert the following line into `/etc/sudoers`:

%git ALL=(git)NOPASSWD:/usr/bin/gitolite trigger SSH_AUTHKEYS

Below is the following I use on my server:

Defaults: site-eyl env_keep += "GL_USER"
%git ALL=(git)NOPASSWD:/usr/bin/gitolite trigger SSH_AUTHKEYS,/usr/bin/gitolite list-phy-repos,/usr/bin/gitolite access *,/usr/bin/gitolite D *

Defaults:git env_keep += "GL_REPO GL_USER GL_BYPASS_ACCESS_CHECKS"
git ALL=(site-eyl) NOPASSWD: /srv/site-eyl/bin/manage gitolitehook,/srv/site-eyl/bin/manage gitolitetrigger *

## License

All code is licensed under GPL v3.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-gitolite-0.1.4.tar.gz (18.0 kB view details)

Uploaded Source

File details

Details for the file django-gitolite-0.1.4.tar.gz.

File metadata

File hashes

Hashes for django-gitolite-0.1.4.tar.gz
Algorithm Hash digest
SHA256 d3a8f2f4de3f420d0e3d15ed167934dcc7bc3bbeb9680c026c44f7983f344a5c
MD5 2f389d3f6c08cc17cd9519a0c43c51a9
BLAKE2b-256 e9f2ab9dfc94af19c3516d042c4413db10346512109bb16ad2a6801177bb2d97

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page