Gitolite

From Dark Peak
Jump to: navigation, search

Personal git hosting is provided by Gitolite. Each user has their own personal Gitolite instance where they can manage their own public and private repositories. All public repositories are browsable in CGit, the web-based repository browser. Each user has complete control over granting access to their repositories via SSH public keys and access control lists.

Set Up

In order to start hosting git repositories, you first have to add your public SSH key to the Dark Peak LDAP service. This will be used to grant access to a special gitolite-admin repository where you can configure and interact with the Gitolite instance. In order to add your SSH public key, visit the LDAP service, click on your username and under Account Settings, SSH public keys, click the 'add' button. Paste your SSH public key into the textarea and click 'set', then click the 'Update' button at the top left of your profile.

After saving your profile, you should be granted access to your gitolite-admin repository. Clone the repository with:

git clone <username>@git.darkpeak.org:gitolite-admin.git

Where <username> is replaced with your Dark Peak username.

Note: Two repositories are created by Gitolite on the server. Your gitolite-admin repository is, by default, not public and will not show up in the CGit repository browser. The testing repository is visible to the public, and will show up in the CGit repository browser.

Also Note: The first time you attempt to connect to clone from git.darkpeak.org you will be warned about the authenticity of the host not being possible to establish. If you wish to verify the fingerprints, currently they are:

* SHA256:J4E31S3RGnFfwyZJxNwnoILBlZclnUi1zduO6Mhh8XM
* MD5:cd:f6:16:4f:13:c0:35:da:b0:51:1d:d5:ec:38:20:80

Adding users / SSH keys

Once you've cloned the gitolite-admin repository, new keys can be added to the keydir directory. Usernames are defined by the filenames, so if you want to grant access to jsmith then you put their SSH public key in the file keydir/jsmith.pub. It's possible to add multiple keys per user by using a naming convention.

Note: In order to completely revoke access for a SSH public key, the file in the keydir must be deleted and it must also be absent from your user account in the Dark Peak LDAP service.

Managing repositories

In the gitolite-admin repository, you can edit the conf/gitolite.conf file to add another repo entry and simply push it to the server to create a new repository. For example:

repo my_new_repo
    RW+ = @all

To remove repositories simply remove the corresponding entry from this file.

More information can be found in the gitolite documentation.

Public repositories

Public repositories can be configured by granting read-access to the special gitweb user.

The repository will then be publicly viewable at, and anonymously cloneable from:

https://git.darkpeak.org/<username>/<reponame>.git

Where <username> is replaced with your Dark Peak username, and <reponame> is replaced with the path of the repository.

Note: The special Gitolite group @all (for all users) contains the gitweb user.

Documentation

The Gitolite website has extensive documentation available and is a good place to look for more information. Gitolite is a very flexible tool and can be configured for many different use cases. Feel free to document other useful tips here on the Dark Peak wiki.

Hooks

The following hooks are available to use:

  • pages - provides static web hosting