1

I have some issue when pushing on a gitlab project repo. When I run git push -u origin master to let's say a remote repo /Users/home/repositories/root/other.git, I get this output :

remote: hooks/update:10: undefined method `require_relative' for main:Object (NoMethodError)
remote: error: hook declined to update refs/heads/master

I think it may come from symlinking issue. Because, I have update and post-receive files inside /Users/home/repositories/root/other.git, and when I delete them and symlink to /Users/home/gitlab-shell/hooks/update and /Users/home/gitlab-shell/hooks/post-receive, and when I run again push, I have the same error and update and post-receive files appear again under /Users/home/repositories/root/other.git. Could someone help ?

epsilones
  • 11,279
  • 21
  • 61
  • 85
  • What git version are you using? Are you pushing directly on the GitLab server? (as in https://github.com/gitlabhq/gitlabhq/issues/3349#issuecomment-15386092) – VonC Oct 08 '13 at 11:50
  • @VonC, no I am using it on my local. If I run `ruby -v`, I get `ruby 2.0.0` ! – epsilones Oct 08 '13 at 11:56
  • And what gitlab version have you installed on your server? – VonC Oct 08 '13 at 11:57
  • @VonC this is the branch `5-0-stable` – epsilones Oct 08 '13 at 12:04
  • That seem old... and not compatible with ruby 2.0. Only 6.x would support ruby 2.0 – VonC Oct 08 '13 at 12:05
  • @VonC I have updated my branch. Now when I run `git push -u origin master`, I get `/home/.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/net/http.rb:878:in `initialize': Connection refused - connect(2) (Errno::ECONNREFUSED)` and of course when I sudo, my `.ssh/config` file is no longer taken into account. How can i manage this perm issue ? – epsilones Oct 09 '13 at 13:08
  • You can start by following the questions / recommendations of https://github.com/gitlabhq/gitlabhq/issues/4566. – VonC Oct 09 '13 at 13:11
  • @VonC thank you and I followed it. But I setup correctly `gitlab_urb` tp `http://0.0.0.0:3000/` and I still get this `connection refused` error. Should I set up `Redis` – epsilones Oct 09 '13 at 13:22
  • So `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production` and `sudo -u git -H ./home/git/gitlab-shell/bin/check` both return an ok status? – VonC Oct 09 '13 at 13:24
  • I confirm redis shoud run (like https://github.com/gitlabhq/gitlabhq/issues/5270#issuecomment-25741479 illustrates) – VonC Oct 09 '13 at 13:25
  • Not sure about that '0.0.0.0' ip address though. Your server is on the same machine than your client? – VonC Oct 09 '13 at 13:27
  • @VonC I confirm redis is running (but no config setup in `gitlab-shell` ). Btw, I get some errors : I checkout `gitlab-shell` to `v1.7.1` branch tag, but I still get this message `FAIL. Please update gitlab-shell to 1.7.1 from 1.1.0` – epsilones Oct 09 '13 at 13:37
  • Strange: Would https://github.com/gitlabhq/gitlabhq/blob/master/lib/tasks/gitlab/check.rake#L738-L767 be buggy (as it was 7 month ago? (https://github.com/gitlabhq/gitlabhq/issues/3404). But for http url, I don't know how the Redis server would interpret a 0.0.0.0 ip address. – VonC Oct 09 '13 at 13:42
  • @VonC but yesterday everything was working just fine, with the same configuration (I had `gitlab 5`) – epsilones Oct 09 '13 at 13:44
  • Check the config (`config/gitlab.yml`): it has changed/evolved between 5 and 6. – VonC Oct 09 '13 at 13:45
  • @VonC Ok I am going to do that. Just to be sure as for the gitlab-shell tag. I created a branch called `v1.7.1` and did some `git pull origin v1.7.1`. Is it Ok ? – epsilones Oct 09 '13 at 13:51
  • You shouldn't have to create a branch. A simple `git pull` in `gitlab-shell` submodule should have been enough to bring you the latest. – VonC Oct 09 '13 at 13:53
  • I confirm ;) https://github.com/gitlabhq/gitlab-shell/blob/master/VERSION should show 1.7.1. Simply try to reset your `HEAD` in `gitlab-shell` to the latest: `git fetch ; git reset --hard origin/master` – VonC Oct 09 '13 at 14:01
  • @VonC now it works ;) So The error I get when running `sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production` is `.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/logger.rb:603:in `initialize': Permission denied`. Btw, my gitlab config seems correct – epsilones Oct 09 '13 at 14:05
  • Do you mean that everything now works? That you still have an error on the `gitlab:check`, but GitLab itself is still working despite that check error? – VonC Oct 09 '13 at 14:07
  • @VonC I still get the same error when I run `git push -u origin master` : `.rvm/rubies/ruby-2.0.0-p195/lib/ruby/2.0.0/logger.rb:603:in initialize: Permission denied` – epsilones Oct 09 '13 at 14:11
  • I have only see this at https://github.com/gitlabhq/gitlabhq/issues/3951#issuecomment-17923525, but without resolution. That might be useful to present your case on the GitLab forum (https://groups.google.com/forum/#!forum/gitlabhq). – VonC Oct 09 '13 at 14:14
  • @VonC I did it ! Btw, how to configure my `.ssh/config` as a sudo. It will be perhaps simpler ! – epsilones Oct 09 '13 at 14:21
  • By sudo, do you means as root? or as your GitLab account (like 'git')? My GitLab `ssh/config` file looks like http://stackoverflow.com/a/16870267/6309. – VonC Oct 09 '13 at 14:24
  • @VonC I mean as root in order not to have perm issue. When I run `sudo git push -u origin master`; I get `ssh: Could not resolve hostname mylocalhost: nodename nor servname provided, or not known fatal: Could not read from remote repository. Please make sure you have the correct access rights and the repository exists. ` – epsilones Oct 09 '13 at 14:27
  • That means first that your `ssh/config` is wrong. What is the url of your remote repo your are pushing to? An ssh one? – VonC Oct 09 '13 at 14:28
  • Yes I try to push from `/home/git/gitlab/somerepo` to `/home/git/gitlab/repositories/root/somerepo` with an `/home/git/.ssh/config` as so `Host mylocalhost Hostname localhost User git IdentityFile /Users/git/.ssh/id_rsa` and the same exact config parameter inside `/home/myhome/.ssh/config` – epsilones Oct 09 '13 at 14:31
  • And what is the ssh url? Plus you only need that config file on the client side (ie in the homedir of the '`myhome`' account). Not on the server side (`/home/git`). You are pushing as 'myhome', right? Not as git or root. – VonC Oct 09 '13 at 14:33
  • @VonC I thought it was `/home/git/gitlab/repositories/root/somerepo`. If not where can I find it ? Yes I am pushing as `myhome` – epsilones Oct 09 '13 at 14:36
  • What `git remote -v` returns when types within your cloned repo in /home/myhome? – VonC Oct 09 '13 at 14:39
  • @VonC I get `origin mylocalhost:root/other.git (fetch) origin mylocalhost:root/other.git (push)` – epsilones Oct 09 '13 at 14:39
  • Then yes, it should be at `/home/git/gitlab/repositories/root/other.git`. Again, the forum might be more useful here. Nothing should be owned by `root` though. Everything should be owned by `git`. – VonC Oct 09 '13 at 14:41
  • @VonC Thank yo for all. Just for curiosity, how the request is processed by `gitlab` when I run `git push` ? – epsilones Oct 09 '13 at 14:50
  • 1
    The `~git/.ssh/authorized_keys` will call `gitlab-shell` first to check if you are authorized. Then GitLab calls git. – VonC Oct 09 '13 at 14:51
  • @VonC I come back again with some news : I chomed to 777 some log file, that for some reason didn't have the right perms. But now, I go back to the same error I experienced yesterday with the `5.0` `gitlab` version ! Here's the result of `git push -u master` : `remote: hooks/update:11: undefined method require_relative for main:Object (NoMethodError) remote: error: hook declined to update refs/heads/master To mylocalhost:root/other.git ! [remote rejected] master -> master (hook declined) error: failed to push some refs to mylocalhost:root/other.git` – epsilones Oct 09 '13 at 15:45
  • @VonC in fact when I add `puts RUBY_VERSION` `~/repositories/test.git/hooks/update`, I get `remote: 1.8.7`, how can it be ? – epsilones Oct 09 '13 at 16:21
  • Because https://github.com/gitlabhq/gitlab-shell/blob/master/hooks/update uses `#!/usr/bin/env ruby` and the `$PATH` in the account used for GitLab must be different than the one used for your account: one must reference the ruby installed in `/usr/bin` I presume. – VonC Oct 09 '13 at 17:03
  • @VonC ok thank you ! So how can i change this reference ? – epsilones Oct 09 '13 at 17:06

0 Answers0