Project

General

Profile

Redmine 3.2 with Gitolite 1.2.0

Added by Michael Stang over 8 years ago

Hi,

I'v setup a new Redmine (3.2.0) server with the gitolie plugin (1.2.0) On an Ubuntu 14.04 with git (1.9.1). I want to use https for the git.

So far I can make a checkout an then a commit, this is working fine, but when I try to push then I get this error message:

git.exe push --progress "origin" master:master

Counting objects: 3, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (2/2), done.
Writing objects: 100% (3/3), 287 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
remote: ENV GL_RC not set
remote: BEGIN failed--compilation aborted at hooks/update line 20.
remote: error: hook declined to update refs/heads/master
To https://xxxx.git
! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'https://xxxx.git'

git did not exit cleanly (exit code 1) (811 ms @ 19.04.2016 16:14:48)

I am searching for the problem since 2 days now, but didn't find a solution so far. Did anyone here may had these error or may know what could be the problem?

If you need additional Information let me please know :-)

Thank you.

Kind regards,
Michael

Edit: I used this guide for installation: https://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_30x_on_Ubuntu_1404_with_Apache2_Phusion_Passenger_MySQL_Subversion_and_Git_(Gitolite)


Replies (2)

RE: Redmine 3.2 with Gitolite 1.2.0 - Added by Michael Stang over 8 years ago

It seems that the problem is in the update hook:

/usr/share/gitolite/hooks/common/update

There is following code:

BEGIN {
    # people with shell access should be allowed to bypass the update hook,
    # simply by setting an env var that the ssh "front door" will never set
    exit 0 if exists $ENV{GL_BYPASS_UPDATE_HOOK};

    die "ENV GL_RC not set\n" unless $ENV{GL_RC};
    die "ENV GL_BINDIR not set\n" unless $ENV{GL_BINDIR};
}

The error show that the push fails at:

die "ENV GL_RC not set\n" unless $ENV{GL_RC};

but as I understand (from what I read so far) the update script should already exited the line before at:

exit 0 if exists $ENV{GL_BYPASS_UPDATE_HOOK};

because it should bypass the update hook. The Question is why is GL_BYPASS_UPDATE_HOOK not existing nad where could we set it so the update hook will be bypassed? Is it in Redmine or in the gitolite plugin where this variable should be set and where? Do someone have an idea?

Update:
Hi again,

i searched the gitolite plugin an found that in the version 1.1.x there was in the file:

/opt/redmine/redmine-3.2.0/plugins/redmine_git_hosting/lib/grack/server.rb

this code:

def smart_http_args
['env', 'GL_BYPASS_UPDATE_HOOK=true']
end

but in the Version 1.2.0 we are using this is missing, so i added it manually in this form to workaraound the problem for now, bevor:

      def smart_http_args
        [
          'env',
          "GL_LIBDIR=#{RedmineGitHosting::Config.gitolite_lib_dir_path}",
          "GL_REPO=#{repository_object.gitolite_repository_name}",
          "GL_USER=#{@env['REMOTE_USER']}",
       ]
      end

after:

      def smart_http_args
        [
          'env',
          "GL_LIBDIR=#{RedmineGitHosting::Config.gitolite_lib_dir_path}",
          "GL_REPO=#{repository_object.gitolite_repository_name}",
          "GL_USER=#{@env['REMOTE_USER']}",
          "GL_BYPASS_UPDATE_HOOK=1" 
        ]
      end

After this change push is working again. The question now is, was this removed on any reason or is this maybe a bug in the 1.2.0 Version of this plugin?

By now i did not see any side effects of the change, but I also have to confese that this is the first time i working with git and I do not exactly know why the update has to be bypased and what the update is exactly doing and if it could have an impact on my data?

Kind regards,
Michael

RE: Redmine 3.2 with Gitolite 1.2.0 - Added by Daniel Dehennin almost 8 years ago

Michael Stang wrote:

It seems that the problem is in the update hook:

I found a better solution ;-)

    (1-2/2)