Gem Version Build Status Code Climate

This gem is a fork from the jbox-gitolite gem employing libgit2/rugged.

This gem is designed to provide a Ruby interface to the Gitolite Git backend system.

It provides these functionalities :

  • SSH Public Keys Management
  • Repositories Management
  • Gitolite Admin Repository Bootstrapping


  • Ruby 1.9.x or 2.0.x
  • a working gitolite installation
  • The rugged bindings to libgit2 with SSH-key credentials added (Version >= 0.21 or dev branch).


gem install gitolite-rugged


Bootstrapping the gitolite-admin.git repository

You can have gitolite-rugged clone the repository for you on demand, however I would recommend cloning it manually. See it as a basic check that your gitolite installation was correctly set up.

In both cases, use the following code to create an instance of the manager:

settings = { :public_key => '~/.ssh/', :private_key => '~/.ssh/id_rsa' }
admin ='/home/myuser/gitolite-admin', settings)

For cloning and pushing to the gitolite-admin.git, you have to provide several options to GitoliteAdmin in the settings hash. The following keys are used.

  • :git_user The git user to SSH to (:[email protected]:gitolite-admin.git), defaults to 'git'
  • :host Hostname for clone url. Defaults to 'localhost'
  • :private_key The key file containing the private SSH key for :git_user
  • :public_key The key file containing the public SSH key for :git_user
  • :author_name: The git author name to commit with (default: 'gitolite-rugged gem')
  • :author_email The git author e-mail address to commit with (default: '[email protected]')
  • :commit_msg The commit message to use when updating the repo (default: 'Commited by the gitolite-rugged gem')

Managing Public Keys

To add a key, create a SSHKey object and use the add_key(key) method of GitoliteAdmin.

# From filesystem
key_from_file = SSHKey.from_file("/home/alice/.ssh/")

# From String, which requires us to add an owner manually
key_from_string = SSHKey.from_string('ssh-rsa AAAAB3N/* .... */JjZ5SgfIKab [email protected]', 'bob')


Note that you can add a location using the syntax described in the Gitolite documentation.

To write out the changes to the keys to the filesystem and push them to gitolite, call admin.save_and_apply. You can also manually call to commit the changes locally, but not push them.

Managing Repositories

To add a new repository, we first create and configure it, and then add it to the memory representation of gitolite:

repo ='foobar')
repo.add_permission("RW+", "alice", "bob")

# Add the repo

To remove a repository called 'foobar', execute config.rm_repo('foobar').


As in the Gitolite Config you can define groups as an alias to repos or users.

# Creating a group
devs ='developers')
devs.add_users("alice", "bob")

# Adding a group to config

Copyrights & License

gitolite-rugged is completely free and open source and released under the MIT License.

Copyright (c) 2014 Oliver G√ľnther ([email protected])

Based on the jbox-gitolite fork by Nicolas Rodriguez, which itself is based on the original gitolite gem by Stafford Brunk.

Copyright (c) 2013-2014 Nicolas Rodriguez ([email protected]), JBox Web (

Copyright (c) 2011-2013 Stafford Brunk ([email protected])