Help browsing Git repository from Redmine
I am evaluating Redmine to be used at my company, since we are switching from Subversion + Trac to Git + (probably) Redmine.
Everything is working fine, except browsing the files on the repositories. It just won't show anything.
I suspect that it has something to do with the repositories being "bare" Git repositories. We are using Gitosis (http://eagain.net/gitweb/?p=gitosis.git;a=blob;f=README.rst) to manage our central repositories, in the same server as the Redmine install, and Gitosis works only with bare repositories (as far as I can tell). .
Is this correct? Is this a bug in Redming or am I doing something wrong?
Thanks a lot,
Could you provide the string you're using to indicate path to your git repository, please?
/var/git is the
$HOME for the "
git" pseudo-user. The "
repositories" dir is created by gitosis, where it keeps all the repos dirs. The contents of the
/var/git/repositories/store.git are what usually you'll find in a git bare repos, like objects, hooks, refs, etc.
I contacted the author of gitosis ('Tv' on #git @ irc.freenode.net), he said that gitosis currently only works with bare repos, but he browsed quickly trough redmine's source code and he thinks redmine's using the wrong commands to browse the source code of the repos, but couldn't look into that right now.
I think too, but maybe (depending famous french rail strikes ;)) I'll have time for it this evening or tomorrow. I love so much git and gitosis that I'll try to give redmine a better git handling. Thank you for your informations.
Rodrigo, you got a permission problem there.
Check who is the user running redmine server, and grant read permissions to it on the repo.
Marcos, I don't think it's a permission problem.
The git repositories are owned by the user 'git' and group 'git', and the rails processes are started by the user 'deploy' (via Passenger / mod_rails). But the repositories have read permission to all users. And even when starting redmine via mongrel by the root user, the problem remains.
I even did a "@sudo chmod -R +r /var/git/repositories/*" just to be sure, to no effect.
Hey guys, I have the same here. Actually it's not e permission problem. I'll try to take a look at the git browser source, but I guess it would take a long time to I feel myself able to hack. Anyway, do you have any news about this issue?
Hi Tiago and everyone,
I still haven't figured out how to change the git browser in Redmine, but I do have found a workaround, as described in a comment by "Stu" in this blog post : you can create a post-update hook on your git bare repos, that will do a git pull of the same repos to a previously created checkout copy on the same server, and point redmine to that full repos instead.
It works fine for new projects, but since Redmine doesn't allow me to change the repository, my old projects still don't have source code browsing.
Thanks for your answer. In my case the problem is a conflict with rails version. The truncate(...) method called by the Redmine's git browser (repositories/_dir_list_content.rhtml) is not compatible with the my actionpack-2.0.2. The workaround here is just replace the truncate method in:
I just replaced the truncate method by this one (which is from a previous version):
def truncate(text, length = 30, truncate_string = "...")
if text.nil? then return end
l = length - truncate_string.length
if $KCODE == "NONE"
text.length > length ? text[0...l] + truncate_string : text
chars = text.split(//)
chars.length > length ? chars[0...l].join + truncate_string : text
...then restarting apache and it works perfectly. I'm using last Redmine 0.7 branch. For trunk releases there is no conflicts between rails 2.0.2 and Redmine.
ps: IMO it's a bad hack since I may have trouble updating rails in the future, but it's ok for now :)
Just formating the source above. Inline sources here seems not to work very well...
def truncate(text, length = 30, truncate_string = "...") if text.nil? then return end l = length - truncate_string.length if $KCODE == "NONE" text.length > length ? text[0...l] + truncate_string : text else chars = text.split(//) chars.length > length ? chars[0...l].join + truncate_string : text end end