Skip to main content
Warning: You are using the test version of PyPI. This is a pre-production deployment of Warehouse. Changes made here affect the production instance of TestPyPI (
Help us improve Python packaging - Donate today!

Python wrapper for gitolite

Project Description

Python wrapper for gitolite. Fork from

Easy and simple to user, just pip install baguette-olite.

Gitolite Setup Prereqs

Using Pyolite is very easy, but requires some initial set up. First, your gitolite-admin repo must contain a directory called repos and another one called groups, and all .conf files in these directories should be included in your gitolite.conf file. For example, your gitolite-admin repo might have the following structure:

├── gitolite.conf
└── repos
    └── [ empty ]
└── groups
    └── [ empty ]

And your gitolite.conf file might look like this:

repo gitolite-admin
    RW+     =   admin

repo testing
    RW+     =   @all

include         "repos/*.conf"
include         "groups/*.conf"

This is required because Pyolite makes changes to files only inside the repos and groups directories.

Repository API

First, we need to initialize a pyolite object with the path to gitolite’s repository.

from pyolite import Pyolite

# initial olite object
admin_repository = '/home/absolute/path/to/gitolite/repo/'
olite = Pyolite(admin_repository=admin_repository)

After that, we can create and get a repo using create and get methods.

# create a repo
repo = olite.repos.get('my_repo')
repo = olite.repos.create('ydo')

# List existing Pyolite repos
repos = olite.repos.all()
for repo_it in repos:

Every repo has an users object, in order to facilitate basic operations: adding, editing and removing users from a repository.

print("Repo's users: %s" % repo.users)
# list a repo's users
users_as_list = repo.users.list()

# add a new user
user = olite.users.create(name='bob', key_path="~/.ssh/")
repo.users.add(olite.users.get('admin'), permission='W+')
repo.users.add('bob', permission='R')

# change user's permissions
repo.users.edit(olite.users.get('admin'), permission='WR+')
repo.users.edit('bob', permission='RCW')

# remove user

Users API

You an easly manipulate users aswell, using allmost the same API.

from pyolite import Pyolite

# initial olite object
admin_repository = '/home/absolute/path/to/gitolite/repo/'
olite = Pyolite(admin_repository=admin_repository)

# create user object
vlad = olite.users.create(name='bob',

# get user by name
vlad = olite.users.get(name='admin')

# add new key to user
vlad.keys.append('just put the key here')

# check if user is admin or not

# list user's keys and repos
keys_as_list = vlad.list_keys()
repos_as_list = vlad.list_repos()

# delete a user by name
deleted_user = olite.users.delete('username')

Release History

This version
History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(12.3 kB) Copy SHA256 Hash SHA256
Source Jul 25, 2017

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting