I have a Redmine installation on the same server as my gitolite repositories.
In order to link my repository to my Redmine instance, I locally cloned the repo with the following command:
git clone --bare --local /home/git/repositories/my-repo.git
Just as I successfully clone the repo on the server, I can navigate through the repo on Redmine, as expected.
The thing is, as soon as I do that, I can't push anything more to the remote repo on my local machine.
When I try
git push
I get the following errors:
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 695 bytes, done.
Total 8 (delta 6), reused 0 (delta 0)
fatal: loose object 455f30c5243ec5b5cc698b1e51bdfb23ee6c1b22 (stored in ./objects/45/5f30c5243ec5b5cc698b1e51bdfb23ee6c1b22) is corrupt
error: unpack failed: unpack-objects abnormal exit
To [email protected]:my-repo.git
! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to '[email protected]:my-repo.git'
Any ideas on that?
EDIT #1
The gitolite logs show the following:
2012-10-22.10:59:59 13121 ssh ARGV=drgomesp SOC=git-receive-pack 'my-repo.git' FROM=187.65.248.7
2012-10-22.11:00:00 13121 access(my-repo, drgomesp, W, 'any'),-> refs/.*
2012-10-22.11:00:00 13121 trigger,Writable,access_1,ACCESS_1,my-repo,drgomesp,W,any,refs/.*
2012-10-22.11:00:00 13121 pre_git my-repo drgomesp W any -> refs/.*
2012-10-22.11:00:00 13121 system,git,shell,-c,git-receive-pack '/home/git/repositories/my-repo.git'
2012-10-22.11:00:00 13121 END
Now go to your Redmine project settings, go to the repositories tab and choose git as the SCM, then put in the Path to repository (in our example this is /var/redmine/git_repositories/donebox.git/) and save the settings. Have a look at your repository tab: you should now be able to browse your repository successfully.
Note: of course, this git repository won't update by itself. You'll have to git fetch it regulary by hand, set up a cron job which will execute the git fetch -command automatically for you. To have your repository (and all your branches) refresh every 10 minutes you can add a cronjob like:
To synchronize with a Mercurial repository, you will have to have a local clone of the repository on the same server you have Redmine installed on.
Note 2 : the appropriate binaries must be reachable by Redmine : Finally, be sure to enable any SCM you wish to use globally in Administration->Settings->Repositories->Enabled SCM Select the SCM that corresponds to your repository and enter the path or URL of your repository.
I managed to get it working pointing the original repo to Redmine, since both sit on the same machine, by following some simple steps:
Add a repository on Redmine with the original repo of gitolite's repository. The path would be something like /home/git/repositories/my-repo.git
.
Initially, Redmine doesn't have any permissions to read the repository, so we fix the problem by adding the Redmine user (usually www-data
or apache
) to the git
group by running usermod -a -G git www-data
(be aware of your server's configuration, because that can be a little different, according to how you configurated gitolite.
Change the UMASK
property on the .gitolite.rc
file, from the default value of 0077
to 0022
, the equivalent of 755 (rwxr-xr-x)
for directories and 644 (rw-r--r--)
for files.
For existing repos, you might need to run a chmod -R g+rX
If you still experience the permissions trouble with Redmine, where it opens a 404
instead of the repo on the repository tab, you might have to run a chmod -R g+rX
on the whole /home/git/repositories
, in order to make sure the Redmine user can read all the way through the repos.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With