Git repositories

Added by Bradford W over 9 years ago

I can't tell you how overjoyed I was to find that git support had just been put in the previous night. Having just jumped onto the git train (via GitHub) I thought I'd try it out. I have a private repository over at github so I'm not sure if that's the case or if maybe I'm just not pointing redmine to the appropriate repository path. I've tried pasting the following alterations with no luck as of yet...I know it's a new ticket and I'd absolutely love to rack on it and report bugs if any are found so any pointers as to what I'm doing wrong would be greatly appreciated. Here's the try-list of paths:

https://github.com/<username>/<projname>/tree/master
git@github.com:<username>/<projname>.git (not a URL I know, I'm desperate...c'mon.)
git://git@github.com:<username>/<projname>.git
git://github.com:<username>/<projname>.git
http://github.com/&lt;username&gt;/&lt;projname&gt;.git

I don't know if it's the https that's the issue or not...I'm gonna have to plead ignorance on this one.

When I set these in the Settings/Repository tab and then click the Project/Repository tab I get: Entry and/or revision doesn't exist in the repository.

I noticed too that the functional test doesn't run, so I'm not sure if this is even intended functionality for people to start trying to utilize.

Replies (14)

RE: Git repositories - Added by John Goerzen over 9 years ago

It wants a path to a local Git repo. As in /home/user/repos/project/.git

I intend to deploy it in production this evening. It seems rock solid to me.

What test failure were you seeing, and did you follow the instructions in doc to untar the git repo before running the tests?

RE: Git repositories - Added by Bradford W over 9 years ago

Yea, that did it...stupid me not reading the docs! I'll go sit in the corner now. Thanks for pointing it out...

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Regarding the Redmine Git repo viewer, I can view when and by whom files were modified. However, I cannot see commit comments and clicking on a revision link gives me an "Entry and/or revision doesn't exist in the repository." error.

Should both of these items be working?

RE: Git repositories - Added by Jim Mulholland over 9 years ago

I have an update on my previous post. After building to our server, I now am able to view our Git commits and comments but not the source tree.

To to summarize:

  • Local:
    • Can view source tree
    • Cannot view commits / comments
  • Server
    • Can view commits / comments
    • Cannot view source tre

Does anybody have any ideas either way? (I've attached a couple screenshots.)

rm_git_local.png - Redmine Git Viewer On Local Box (57.1 KB)

rm_git_server.png - Redmine Git Viewer On Server (57.1 KB)

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Hopefully, this will be my last Git integration question...

You have to have a .git repository on your Redmine server for every project you would like to follow with the Redmine repository viewer. The issue with this is:

  1. You have to log into your Redmine server and do a "git clone" of every project you want to follow
  2. The commits on your Redmine viewer are not updated unless you log into your Redmine server and do a "git pull" for each project followed in Redmine

Is this correct? Are there any ways around either of these issues? (i.e. rake, cap, or chron tasks to automate the pull's for us?)

- Jim

RE: Git repositories - Added by John Goerzen over 9 years ago

Well, I think the idea is that the git data for projects would tend to be local to the redmine server anyway.

But if not, yes, you would have to git clone --bare once, then it would be trivial to set up a cron job that does a git fetch in each directory to pull in remote changesets.

Git is distributed and by its very nature does not query a remote server for any log, path, etc. information.

I am not following your local vs. server discussion above. What exactly is the difference between your "local" setup and your "server" setup? And are you sure you have pointed redmine at the .git directory? (should contain entries like config, hooks, HEAD, etc)

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Hi John, thanks for the reply.

Unfortunately, the majority of our projects are on a separate box from Redmine, but doing a git clone works + cron job should work since we are not setting up new projects all that often.

As for my local vs server discussion, one screenshot shows the Redmine Git repo how it looks on my local machine where I can see the source tree but no commit data. The second screenshot shows the Redmine Git repo on our main Redmine server where I can see commit data but no source tree.

Both are pointing to the .git directory and both are using the same version of Redmine. Judging by your response, you have not experienced this issue which makes me think I have something going on my end. I'll dig a little deeper to see what I can find out.

Thanks again.

Jim

RE: Git repositories - Added by John Goerzen over 9 years ago

Right. I've spot-checked a few just now, but from what I can see, all of my Git projects at http://software.complete.org/ are working just fine.

Are you running Redmine trunk, or what version of Redmine do you have?

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Wow...Your repos look just like I was hoping for.

I pulled from trunk last night.

RE: Git repositories - Added by John Goerzen over 9 years ago

That is pretty much what I'm running, too.

What versions of Git do you have on each machine?

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Good point about the Git version.

My local is 1.5.3.6.

Our server is 1.5.2.5.

I have another computer that is running version 1.5.4.3. Let me try it on that machine and see what I get.

RE: Git repositories - Added by John Goerzen over 9 years ago

Ah HA. Both are too old.

You need 1.5.4.2 or above, and this is documented at RedmineRepositories.

RE: Git repositories - Added by Jim Mulholland over 9 years ago

Wow...This is deja-vu all over again! I had a similar forum conversation with JP a few months back when I couldn't get SVN working with Redmine and it turned out my version of SVN was too old!

So I installed and verified on my computer with version 1.5.4.3 and all works there!

I really do appreciate the help. I apologize sending you down this wild goose chase!

- Jim

RE: Git repositories - Added by Stuart George over 9 years ago

Instead of having cron jobs to fetch and pull on set intervals you can chmod +x the post-update hook to run after every commit. My post-update runs a script that does;

line 2 is the local checkout path of the repo
line 4 is pulling from the master .git directory {REPONAME} shows what you need to change, its not an environment var or anything
(so cut and paste wont work).

#!/bin/sh
cd /var/git/checkout/{REPONAME} || exit
unset GIT_DIR
git pull /var/git/repositories/{REPONAME}.git/ master

My repo's are managed via gitosis so the raw repo appends a .git onto the end of the name. I have each repo checked out locally via git clone --local so I'm creating hardlinks and saving space.

(1-14/14)