Package: trac-GitolitePlugin
This plugin provides two-way integration with gitolite: https://github.com/sitaramc/gitolite1. Users who don't have read access to a repository in Gitolite will be blocked from viewing that repository in Trac's web browser2. Trac admins may manage users' gitolite-based repository permissions through the Trac web interface3. Trac admins may add and remove users' SSH public keys through the Trac web interface to control access to the gitolite system4. Trac admins may use a "Create New Repository" feature to initialize an empty gitolite repository through the Trac web interfaceInstallation============Overview--------1. Install Trac and Gitolite on the same server.2. Ensure that the system user running the Trac process has filesystemread access to all gitolite repositories in the present andfuture.  The simplest way to do this is to run Trac as the gitoliteuser; the more correct way is to add the Trac and Gitolite users toa shared group, set ``UMASK=>0027`` in ``.gitolite.rc`` as well asrunning chmod to fix up permissions on the already-created files.3. Ensure that the system user running the Trac process can clone andpush the gitolite-admin repository, by setting up an SSH keypairfor the Trac user, adding that public key to ``gitolite-admin/keydir``and adding RW+ (or just RW) permissions to the corresponding userin ``gitolite-admin/conf/gitolite.conf`` for "repo gitolite-admin".4. Tell Trac about the existence of the gitolite-admin repository byrunning a command like ``trac-admin <env> repository addgitolite-admin $GITOLITE_HOME/repositories/gitolite-admin.git git``5. Install the trac_gitolite plugin, enable its components in trac.iniand prepend "GitolitePermissionPolicy" to your site's trac.inipermission_policies settings.Detailed Instructions---------------------First, install both Trac and Gitolite in the standard ways.  They mustbe installed on the same server.You will need to ensure that Trac has the necessary read access to thefilesystem directory that contains your gitolite repositories.  If Tracis running as user "wsgi" and gitolite has been installed to run as user"git" with a homedir /home/git/ you will probably want to run a commandon your server like this::sudo groupadd infrasudo usermod -a -G infra wsgisudo usermod -a -G infra gitsudo chown -R git:infra /home/git/repositories/sudo chmod -R g+rXs /home/git/repositories/(The +s ensures that new files created in the git repositories, likenew commit objects in the repos, will retain the "infra" group-ownershiprather than reverting to the git user's primary group.)You will also need to ensure that Trac can continue to read all neededfiles over time.  One way to do this is to set the UMASK setting in``.gitolite.rc`` to 0027.  Another way would be to set the repositoryconfiguration ``core.sharedRepository = group`` in all existing and newrepositories (including gitolite-admin) using a repository template.Now Trac will be able to read from your gitolite repositories using itsstandard repository features.You then need to add the gitolite-admin repository itself to Trac.This will allow Trac to read configuration files directly from thegitolite-admin repository using its own version-control APIs.  Do thiswith a command line::trac-admin /path/to/env/ repository add gitolite-admin /home/git/repositories/gitolite-admin.git gitFrom now on, to add an existing gitolite repository named"my-first-repo" to yourTrac system, you would add a Trac git repository named "my-first-repo"with directory ``/home/git/repositories/my-first-repo.git``through Trac's standard administrative web interface, shell scripts,or configuration files.Next, you will need to grant the Trac system user read and writepermissions on the gitolite-admin repository through gitolite itself.This is how Trac will write changes to your Gitolite system (web-baseduser, permission and repository management) -- it will clone thegitolite-admin repo, write changes, commit and push them back to theserver.To do this -- again supposing that Trac is running as user "wsgi" --you will run commands on your server like this::sudo su wsgissh-keygenexitcd /tmp/git clone git@localhost:gitolite-admin.gitcd /tmp/gitolite-admin/echo "repo    gitolite-adminRW+ = wsgi" >> ./conf/gitolite.confsudo cp ~wsgi/.ssh/id_rsa.pub ./keydir/wsgi.pubgit add keydir/wsgi.pub conf/gitolite.confgit commit -m "configuring trac_gitolite permissions"git pushFinally, enable the trac_gitolite components in trac.ini for your site::[components]trac_gitolite.* = enabledThis will add three new panels to the "Version Control" section in the Trac Admin.  To additionally enable the permission policy, add to your trac.ini::[trac]permission_policies = GitolitePermissionPolicy, AuthzPolicy,DefaultPermissionPolicy, LegacyAttachmentPolicyConfiguration=============Sensible defaults are provided that should work for most typicalinstallations of Trac and Gitolite. The following trac.ini options(all in a `[trac-gitolite]` section) can be modified if necessary:* admin_reponame: defaults to gitolite-admin; this is the name *intrac* of the gitolite-admin repository* admin_real_reponame: defaults to gitolite-admin; this is the name*in gitolite* of the gitolite-admin repository* admin_ssh_path: defaults to git@localhost:gitolite-admin.git* admin_system_user: defaults to "trac"; this is the name *ingitolite* of the system user running the trac web process* default_private: defaults to True; when set to True (the default)repositories known to Trac which are missing from gitolite.confwill not be visible through the Trac source browser to any users.Set this to False to defer those repositories' permissions to therest of the Trac permission system.* all_includes_anonymous: defaults to False; when set to True,repositories with `@all = R` in `gitolite.conf` will be viewablethrough the web by anonymous users. The default is to make theserepositories viewable by all logged-in users only.Known Deficiencies==================Patches are welcome for any of these known deficiencies:* Only the most basic Gitolite configuration is supported; any of thefollowing advanced gitolite features will cause the plugin to fail:* refexes are unsupported: they cannot be configured throughthe Trac admin UI, and they are not respected by the TracBrowser permission policy.* deny rules are unsupported* user groups (aside from `@all`) are unsupported* project groups are unsupported* conf includes are unsupported* permissions other than R, W, + are unsupported: C, D, M* Probably there are other unsupported advanced Gitolite features thatI don't even know about -- feel free to tell me about them* The process of creating a new repo is a bit confusing (first createit in Gitolite Repositories, then add it in Repositories)* The permission-management UI is overwhelming* All users are assumed to have the same usernames in Trac as theirgitolite names.* All repositories are assumed to have the same names in Trac as theydo in gitolite.* The behavior of Trac repository aliases have not been tested at all* I think TRAC_ADMIN is not respected (TRAC_ADMIN users should haveaccess to all repositories regardless of the gitolite.confpermissions, unless a configuration option says otherwise)* Comments in the gitolite conf file will be overwritten when savingchanges through Trac; in general, the gitolite conf file'sparticular contents, ordering and formatting will not be preservedreliably through Trac writes.* The whole approach -- of having Trac clone, edit, commit and pushthe gitolite-admin repository during the user's web request withsubprocesses -- is a pretty terrible hack, but I don't know ifthere's any possible alternative.  (I don't think Gitolite has anAPI.)  Using dulwich instead of `subprocess.call(['git', 'clone'])`etc would reduce the hackishness I guess.0.3.1 (Dec 06 2012)-------------------Fixed error in previous release.0.3.0 (Dec 06 2012)-------------------Permission manager no longer deletes configuration for users who are mentioned ingitolite.conf but absent from the keydir, and no longer deletes configuration forgroups.0.2.4 (Nov 10 2012)-------------------Fixing formatting issues (in docs and in MANIFEST.in) in previous release.0.2.3 (Nov 10 2012)-------------------Fixing formatting issues (in docs and in MANIFEST.in) in previous release.0.2.2 (Nov 10 2012)-------------------Fixing formatting issues (in docs and in MANIFEST.in) in previous release.0.2.1 (Nov 10 2012)-------------------Fixing formatting issues (in docs and in MANIFEST.in) in previous release.0.2.0 (Nov 10 2012)-------------------Added MANIFEST.in to ensure that template files are included in installed package.