Content
OpenProject Git Hosting / Git Repositories Management through Gitolite
Added by Oliver Günther over 10 years ago
This plugin aims to provide extensive features for managing Git repositories within OpenProject.
Find it at: https://github.com/oliverguenther/openproject-git_hosting
Its forked from jbox-web’s version of the long-lived, often-forked redmine-git_hosting plugin (formerly redmine-gitosis).
As OpenProject has diverted quite a bit in terms of project management (e.g., redmine allows multiple repositories per project), some features have been removed in the fork.
High-level overview:
- Depends on Gitolite (v2/v3)
- Acts as a wrapper to the gitolite-admin to feed gitolite with SSH keys, repository information
- Employs libgit2/rugged through my gitolite-rugged wrapper gem
I’m currently working on providing the following features, more may follow, depending on demand and my time:
SSH Public-Key Management (Gitolite)
Gitolite Repository Management
✓ Managing repositories with Gitolite upon creation, update/deletion. (Async w/ delayed_jobs)
✓ Members/Roles access written to Gitolite.
✓ SSH-based access (through Gitolite).
Planned / Forked, but non-functional / non-tested features
Ordered by importance for our use case.
- Git Smart-HTTP (Access through https in OpenProject)
- Post-Receive Hooks
- Repository Mirrors
- Deployment Keys
- Initialize Repositories with Readme
Stripped features (irrelevant for our use case, may be included later on)
- Sidekiq (OP uses delayed_jobs instead)
- SELinux (unfamiliar, can’t provide a good fork)
- GitHub features (Issues), should be separate plugin
- Git access cache ( belongs in the core )
- Repository Recycle bin after deletion (Just use your filesystem backups)
- Notifications / Mailing lists
Pitfalls / Disclaimer
This plugin is by no means stable yet.
It traditionally depends heavily on patches in the core, especially hooking methods in repository creation / management and the Git adapter.
However, feel free to try and report any issues to me, either here, or (preferably) on Github
Quite some work is to be done in the core / moved into gems, I will try to work on that as the plugin matures. There exists an epic to improve repository adapters: https://www.openproject.org/work_packages/12808.
Feel free to join the discussion around adapters there.
Installation (OP 3.0.8)
I’m assuming you have some basic knowledge of Gitolite and:
- are in possession of an SSH key pair set up for use with gitolite.
- have cloned the gitolite-admin.git repository.
1. Add a Gemfile.plugins to your OpenProject root with the following contents:
gem "openproject-plugins", :git => "https://github.com/opf/openproject-plugins.git", :branch => "stable" gem "openproject-git_hosting", :git => "https://github.com/oliverguenther/openproject-git_hosting.git", :branch => "dev"
2. Ensure the user running OpenProject can sudo to the gitolite user. Assuming that user is called openproject and the gitolite user is git, open visudo and add:
openproject ALL=(git) NOPASSWD:ALL
3. Make sure you can ssh into gitolite from the openproject user. If you run the following command, the output below (or similar for gitolite2) should appear.
If not, this is a gitolite configuration error.
openproject$ ssh -i <gitolite-admin SSH key> git@localhost info hello openproject, this is git@dev running gitolite3 v3.x-x on git x.x.x R W gitolite-admin R W testing
4. Run OpenProject, go to Admin > Plugins > OpenProject Git Hosting (click on configure)
Set your values on Gitolite accordingly and click save. Check that the output on the tab ‘Config Test’ looks good.
Note that many of the settings are not yet functional, and some values on config test are thus irrelevant (Hooks, for example).
Adding SSH keys
- Log in, go to My Account (top right).
- Select ‘Public Keys’ in the menu on the left.
- Add your public key using the form.
Adding repositories
- Create project. Go to repositories settings and select Git + click create.
- This will (should) automatically create the corresponding entry in the gitolite configuration.
- Use members to add a member to the repository. If that user has a public key on record, the corresponding access rights will be written to Gitolite.
Replies (3)
Hi Oliver,
wow, thanks for your hard work and the detailed instructions. :)
This looks really great!
Do you mind if we include this plugin in the list of plugins
Best,
Robin
Here again, I would appreciate adding the Plugin to the list. However, as this plugin is still under heavy development, could you (if you decide to add it) append a small note to the description concerning its status?
I don’t want someone to eagerly install it and then be disappointed by its development status ;)
This is a good point.
I added the plugin to a separate section and a note that it is still in development.
Thank you very much again for your hard work. :)
This is a great addition to OpenProject!
Best,
Robin