Project

General

Profile

Actions

Patch #2525

open

Redmine management of Git repositories

Added by Sentinel T about 15 years ago. Updated over 10 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
SCM
Target version:
-
Start date:
2009-01-18
Due date:
% Done:

80%

Estimated time:

Description

This patch introduces Redmine management of Git repositories.
The design is based on the Gitosis tool.
  • To enable the feature check 'Serve Git repositories using Redmine's SSH account'
    in global Settings/Repositories.
  • Then each user can specify its public SSH key in the My Account page
  • Redmine is configuring '~/.ssh/authorized_keys' file to allow SSH for Redmine users
    authorized by SSH public key. The shell is restricted to Redmine's GitManager:serve function.
  • This function then checks the corresponding rights of the user who logs in
    to the repository he wants to access. Also it rewrites the URL to the repository,
    so the user can specify simpler version: 'redmine_user@server_name:redmine_project_identifier'.
  • If the repository does not exists, it is created on the fly
  • Redmine also installs own hooks which further check the correctness of the commits
    pushed to the repo, ex:
    • Is the commiter of the commit equal to the user which pushes to the repository
    • Is the push fast-forward
    • Are the referenced issues correct

The patch is probably still very buggy. No localization. No much tests. Nevertheless it works for me on my Linux machine. I'm posting for wider review. Comments welcomed.


Files


Related issues

Related to Redmine - Feature #7747: Add capability to ask\accept\reject review of patches (flag support on attachments)New2011-03-01

Actions
Actions #2

Updated by Joe Glenn about 15 years ago

Sentinel T wrote:

This patch introduces Redmine management of Git repositories.
The design is based on the Gitosis tool.
  • To enable the feature check 'Serve Git repositories using Redmine's SSH account'
    in global Settings/Repositories.
  • Then each user can specify its public SSH key in the My Account page
  • Redmine is configuring '~/.ssh/authorized_keys' file to allow SSH for Redmine users
    authorized by SSH public key. The shell is restricted to Redmine's GitManager:serve function.
  • This function then checks the corresponding rights of the user who logs in
    to the repository he wants to access. Also it rewrites the URL to the repository,
    so the user can specify simpler version: 'redmine_user@server_name:redmine_project_identifier'.
  • If the repository does not exists, it is created on the fly
  • Redmine also installs own hooks which further check the correctness of the commits
    pushed to the repo, ex:
    • Is the commiter of the commit equal to the user which pushes to the repository
    • Is the push fast-forward
    • Are the referenced issues correct

The patch is probably still very buggy. No localization. No much tests. Nevertheless it works for me on my Linux machine. I'm posting for wider review. Comments welcomed.

I really like what you've done here I hope you keep up on it and it becomes an addition to redmine officially

Actions #3

Updated by Isaiah DeRose-Wilson about 15 years ago

Sentinel T, your patch works great on my server. It makes dealing with git repos just as easy as github, great work!

I did have a problem with the changeset.rb file through, when I do a new comment that closed a ticket, it crashes repository page. Reverting back to the unpatched changeset.rb file fixed this.

Also it would be very cool to have support for multiple ssh keys per account. I normally use the same account on my laptop, and it's easier to just generate a second key instead of copying my private key.

Thanks for the patch!

Actions #4

Updated by Sentinel T about 15 years ago

Isaiah DeRose-Wilson wrote:

I did have a problem with the changeset.rb file through, when I do a new comment that closed a ticket, it crashes repository page. Reverting back to the unpatched changeset.rb file fixed this.

I will look into this.

Also it would be very cool to have support for multiple ssh keys per account. I normally use the same account on my laptop, and it's easier to just generate a second key instead of copying my private key.

This is doable. I only need to figure out how to design the GUI to allow entering unlimited number of keys.

Actions #5

Updated by Isaiah DeRose-Wilson about 15 years ago

Thanks for the reply Sentinel T, I think this patch would be a great addition to the redmine core once it's tested a bit more.

Actions #6

Updated by Renato Atilio about 15 years ago

Any update on this patch?
If needed, I can help in bug fixing it. Great way to serve Git without relying on WebDav.

Actions #7

Updated by Tomek Piotrowski about 15 years ago

I've rewritten bunch of code, added support for multiple SSH keys per account and SSHV1 keys - previously AuthorizedKeysEntry model crashed on SSHV1 keys. I've also changed the UI on 'My Account' page. The patch still needs a lot of polishing when it comes to UI, i18n support and tests.

Applicable against 0.8.2

Actions #10

Updated by Renato Atilio almost 15 years ago

Is there any way this could go to a plugin, instead of a patch?
I'm using github's master branch right now, and still wishing to use some plugins and ScrumAlliance stuff.
That said, I don't think it's trivial to apply this patch to this already "random" version.
Anyway, if it's not possible or not viable, I think I can try to downgrade my version. I just need to be sure before :)
Oh, and thanks for the great work.

Actions #11

Updated by Tomek Piotrowski almost 15 years ago

I'll try to look into it if I'll have some free time next week

Actions #12

Updated by a aslak almost 15 years ago

Which version of redmine is the 04 patch made for? I've tried with the 0.8.3 release but it dosen't work (the pub key form in account.rhtml is rejected and repository auto-creation is not working).

Actions #13

Updated by Lorenzo Pisani almost 15 years ago

I would also love to see this as a plugin
great work though, this patch is the reason I decided to use redmine for my work

Actions #14

Updated by Isaiah DeRose-Wilson over 14 years ago

Lorenzo Pisani wrote:

I would also love to see this as a plugin
great work though, this patch is the reason I decided to use redmine for my work

I totally agree, this patch makes git+redmine a great experience.

Actions #15

Updated by Yitzhak Bar Geva over 14 years ago

Isaiah DeRose-Wilson wrote:

Lorenzo Pisani wrote:

I would also love to see this as a plugin
great work though, this patch is the reason I decided to use redmine for my work

I totally agree, this patch makes git+redmine a great experience.

Please keep me informed. After Googling, I've come to the conclusion that Redmine/Git is the ideal environment for our development team. I'm about to install, but I was wondering if instead of messing with patches (which I don't know how to handle yet), it wouldn't be better to hang on for the plugin. Advice is warmly welcomed

Actions #16

Updated by Yitzhak Bar Geva over 14 years ago

Tomek Piotrowski wrote:

Had a bad day obviously... this one is good xD

Before I proceed to apply the patch (fingers crossed. I've never done this before), I'd like to ask if the patch is against any particular version/tag of Redmine.
Thanks

Actions #17

Updated by Isaiah DeRose-Wilson over 14 years ago

Yitzhak Bar Geva wrote:

Tomek Piotrowski wrote:

Had a bad day obviously... this one is good xD

Before I proceed to apply the patch (fingers crossed. I've never done this before), I'd like to ask if the patch is against any particular version/tag of Redmine.
Thanks

I think the patch was made for 8.2, hopefully someone that is better at ruby than me will update this patch to work with the latest version of redmine.

Actions #18

Updated by Andrzej Giniewicz over 14 years ago

Isaiah DeRose-Wilson wrote:

Lorenzo Pisani wrote:

I would also love to see this as a plugin
great work though, this patch is the reason I decided to use redmine for my work

I totally agree, this patch makes git+redmine a great experience.

+1. Are there plans to include this in 0.9?

Actions #19

Updated by Jan Losinski over 14 years ago

+1. I will need this because maintaining Gitosis with a lot of users/repos does not scale very well.

Actions #20

Updated by Sentinel T over 14 years ago

  • % Done changed from 0 to 80

I've fixed some issues with multiple keys per account. There is still known problem with uploading the same key multiple times.

To help you avoid any issues with applying the patch I've uploaded the changes to git-hub:
http://github.com/sentinelt/redmine/commits/gitmanagement

Here is the link for the ZIP file with the entire Redmine 0.8.4 with the patch applied:
http://github.com/sentinelt/redmine/zipball/gitmanagement

Is there any way this could go to a plugin, instead of a patch?

I don't think it is possible to write the entire patch as plugin. On the other hand I'm not Ruby/Rails guru...

Actions #21

Updated by Matthieu Codron over 14 years ago

Hi, what is the status of this patch regarding redmine developpement? I mean, do you plan to include it in next redmine releases, or will it be updated to match current redmine release?
And last question, you updated progress to 80%, could you explain you you consider as being 100%, please?

Nevertheless, thanks a lot for this really usefull patch.

Actions #22

Updated by Chris Miller over 14 years ago

+ 1

I'm looking forward to this.

Actions #23

Updated by Sentinel T over 14 years ago

Matthieu Codron wrote:

Hi, what is the status of this patch regarding redmine developpement?

I haven't contacted anyone from Redmine team regarding this patch yet. We are using Redmine heavily at Atteo.com. And this is one of the patches which we felt might be useful for the general consumption. If I get the approval from Redmine, I'm willing to invest some time to upgrade this patch into latest trunk.

you updated progress to 80%, could you explain you you consider as being 100%, please?

It WorksForMe(tm). The last 20% is just to remind anyone that I haven't tested it a lot. Also I'm not regular Ruby/Rails/Redmine developer, so the code might need some rework before being included in the mainline.

Actions #24

Updated by Chris Miller over 14 years ago

The settings file says "Serve GIT repositories using Redmine's SSH account." For those of us using Passenger, will this cause Git to be run using www-data?

Important question I have to ask.

Actions #25

Updated by Matthieu Codron over 14 years ago

Sentinel T wrote:

I haven't contacted anyone from Redmine team regarding this patch yet. We are using Redmine heavily at Atteo.com. And this is one of the patches which we felt might be useful for the general consumption. If I get the approval from Redmine, I'm willing to invest some time to upgrade this patch into latest trunk.

It would be very interseting, I think, for redmine users like my team :) What do Redmine team think about it?

you updated progress to 80%, could you explain you you consider as being 100%, please?

It WorksForMe(tm). The last 20% is just to remind anyone that I haven't tested it a lot. Also I'm not regular Ruby/Rails/Redmine developer, so the code might need some rework before being included in the mainline.

If only I was a ruby developer, I'd like to help you reviewing thix code... but I have no knowledge in this area. I can only hope you'll find time, energy, and help from community to accomplish this.

Actions #26

Updated by Anonymous over 14 years ago

+1 for inclusion into 0.9 :-)

Actions #27

Updated by Chris Miller over 14 years ago

Markus May wrote:

+1 for inclusion into 0.9 :-)

0.9 has gone under feature freeze. Maybe if it's cleaned up in time for 1.0?

Actions #29

Updated by Anonymous over 14 years ago

I think that this kind of functionality should be developed as a plugin, probably using some pre-existing tool like GitAuth. This would leave the code of Redmine free of such VCS-specific code. Furthermore since this is basically a kind of "Security-related" issue, I definitly would vote for using something like GitAuth, since they know their stuff and are doing this for more then Redmine.

Still +1 for soon implementation of this feature.

Actions #30

Updated by Matthieu Codron over 14 years ago

Yes, it would better be a plugin.
I was thinking it could not be a plugin, but after thinking about it, it appears irt would be much more powerfull and secure to have a plugin that links redmine with gitolite.
Maybe refer to this forum thread on this idea: http://www.redmine.org/boards/1/topics/9909

Actions #31

Updated by Kamil . over 14 years ago

Yes, it would better be a plugin.

What differs GIT from SVN and CVS (which are supported out of the box)?

Actions #32

Updated by Jan from Planio www.plan.io about 14 years ago

We're using a Gitosis-based approach for Planio. You can check out our plugin on Github. It works perfectly for us, however, I would love to see a GitAuth-based plugin evolving from this as it would help avoid a couple of shellouts and SSH hacks :)

Actions #33

Updated by Ben Langfeld almost 14 years ago

Any progress on this?

Actions #34

Updated by micah anderson almost 14 years ago

Jan from www.plan.io wrote:

We're using a Gitosis-based approach for Planio. You can check out our plugin on Github. It works perfectly for us, however, I would love to see a GitAuth-based plugin evolving from this as it would help avoid a couple of shellouts and SSH hacks :)

I tried to use your plugin, but I could not get it to work. I downloaded it, and put it in the redmine plugins directory. I did the migration. I then restarted apache and then found (through trial and error) that I needed the following ruby libraries installed: libnet-ssh2-ruby, liblockfile-ruby (these are the debian packages) and the gem 'inifile'. Once I figured that out, I tried to go use it, but I could not figure out how. There were no settings in the Admin interface, nor in the inidividual projects that I could find... I ended up disabling it, I sure would like it though.

Actions #35

Updated by Sentinel T almost 14 years ago

Ben Langfeld wrote:

Any progress on this?

I've started some new work on the patch a few days ago.

Git recently added a way to push through HTTP (http://www.kernel.org/pub/software/scm/git/docs/howto/setup-git-server-over-http.txt). And I plan to add a support for that, so that during the push Git will ask for a Redmine's login and password. I'm also researching a bit for a way to authenticate the user password-less with SSL user certificates when serving using HTTPS.

I will also update the patch for the latest version of Redmine.
But it's not my goal to convert the patch to a plugin.

Actions #36

Updated by Domen Kožar over 13 years ago

Are there any plans on supporting gitolite since gitosis is deprecated?

Actions #37

Updated by Nicholas Kulikov about 13 years ago

Very interesting functionality. Is it possible to apply this patch to redmine 1.x?

Actions #38

Updated by Toshi MARUYAMA about 13 years ago

  • Category set to SCM
Actions #39

Updated by Sentinel T about 13 years ago

All, I've abandon this patch. In my own deployments I use Gerrit now configured to authenticate with Redmine. This solution provides all the functionality I wanted this patch to have.

Actions #40

Updated by Nicholas Kulikov about 13 years ago

Hi, Sentinel,

How did you configure gerrit for redmine? Could you share your expirience? :)

Actions #41

Updated by Sentinel T about 13 years ago

Hi Nicholas,

I tried to write another authorization method for Gerrit which used Redmine's user database. But it is still not in any usable state.
For the time being I've configured both Gerrit and Redmine to use common OpenID server for authorization.
Also I have 'change-merged' hook in Gerrit that triggers fetching of Git changes into Redmine.

Actions #42

Updated by Nicholas Kulikov about 13 years ago

Thanks for information!

Actions #43

Updated by Jonas Juselius over 12 years ago

The gitosis plugin is broken under 1.2.1. When Repository.fetch_changesets() is called from redmine, gitosis goes into what seems like an infinite loop of cloning gitosis-admin.git over and over and over again. The result is that the machines gets swamped and no changesets get fetched. Please see http://www.redmine.org/boards/2/topics/25785 and issues #8973 and #8857 for more information. The gitosis plugin is currently unusable under redmine 1.2.1, since the only way to get fetch_changesets to work is by uninstalling the gitosis plugin.

Actions #44

Updated by Timothy Allen over 12 years ago

Since your using 1.2.1 you might wanna consider upgrading to gitolite + red mine_git_hosting . The combination is more powerful and faster, plus it works with 1.2.x.

Actions #45

Updated by Timothy Allen over 12 years ago

Sorry, I double stuffed the links. Here is the redmine_git_hosting link.

Actions #46

Updated by Jonas Juselius over 12 years ago

Thank you! We have been planning to switch to gitolite anyway, since it's far superior to gitosis.

Actions #47

Updated by William Van Hevelingen over 11 years ago

The redmine_git_hosting plugin doesn't look actively maintained...... and doesn't support redmine 2.x. There is a 2.0-migration branch but it hasn't been touched in the last ~4 months.

Actions #48

Updated by rm user over 10 years ago

William Van Hevelingen wrote:

The redmine_git_hosting plugin doesn't look actively maintained...... and doesn't support redmine 2.x. There is a 2.0-migration branch but it hasn't been touched in the last ~4 months.

try this - https://github.com/jbox-web/redmine_git_hosting

it works fine with redmine 2.2.4, would be good if it's functionality could be bundled with redmine because its very essential to have working GIT management system with extended capabilities.

Actions

Also available in: Atom PDF