Bug 208693 - www/gitlab: can't push anything
Summary: www/gitlab: can't push anything
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: Kurt Jaeger
URL: https://git.unixcorn.org
Keywords: patch, patch-ready
Depends on:
Blocks: 209903
  Show dependency treegraph
 
Reported: 2016-04-11 09:01 UTC by Mathias B.
Modified: 2016-06-02 06:16 UTC (History)
3 users (show)

See Also:
ports: maintainer-feedback+


Attachments
patch with patched config for devel/gitlab-shell and www/gitlab (1.76 KB, patch)
2016-05-18 14:32 UTC, Torsten Zühlsdorff
no flags Details | Diff
patch to update gitlab-shell (1.30 KB, patch)
2016-05-31 15:07 UTC, Torsten Zühlsdorff
ports: maintainer-approval+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias B. 2016-04-11 09:01:24 UTC
Hello,

Since I've properly installed Gitlab from ports we are unable to push anything on the repositories.

All users got the following error:
remote: GitLab: The project you were looking for could not be found.
To git@unixcorn.org:Papey/dotfiles.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: impossible de pousser des références vers 'git@unixcorn.org:Papey/dotfiles.git'

I told them to verify their configuration (who seems OK):
ssh -T git@unixcorn.org
Welcome to GitLab, XXXXXXX XXXXXXXXX!

I also checked the repositories rights:
root@hulk:/usr/local/www/gitlab # ls -al /usr/home/git/repositories/
total 11
drwxrws---  6 git   git   6 Apr 11 10:30 .
drwxr-xr-x  7 git   git  19 Apr 10 21:05 ..
drwxrwx---  2 git   git   2 Apr 11 10:59 Papey
drwxrwx---  2 git   git   2 Apr 10 19:33 UnixcornProject
drwxrwx---  4 git   git   4 Apr 11 10:59 matunixe

Any help would be very appreciated.
Thanks in advance !
Comment 1 Torsten Zühlsdorff 2016-04-11 09:14:15 UTC
Hello,

that is strange. Can you please report me the result of the following two commands:

ls -lah /usr/local/share/gitlab-shell/hooks/

and:

pkg info gitlab-shell

Greetings,
Torsten
Comment 2 Mathias B. 2016-04-11 12:16:32 UTC
(In reply to Torsten Zühlsdorff from comment #1)
Hello Torsten,

Thank you for your very quick reply, there is the result:

total 45
drwxr-xr-x  2 root  wheel     5B Apr 10 13:30 .
drwxr-xr-x  7 root  wheel    22B Apr 10 13:30 ..
-r-xr-xr-x  1 root  wheel   492B Mar 31 20:15 post-receive
-r-xr-xr-x  1 root  wheel   483B Mar 31 20:15 pre-receive
-r-xr-xr-x  1 root  wheel   357B Mar 31 20:15 update

And for the pkg info:
gitlab-shell-2.7.1
Name           : gitlab-shell
Version        : 2.7.1
Installed on   : Sun Apr 10 13:30:23 2016 CEST
Origin         : devel/gitlab-shell
Architecture   : freebsd:10:*
Prefix         : /usr/local
Categories     : devel
Licenses       : 
Maintainer     : ports@toco-domains.de
WWW            : https://gitlab.com/gitlab-org/gitlab-shell
Comment        : GitLab Shell handles git commands for GitLab
Annotations    :
Flat size      : 147KiB
Description    :
GitLab Shell handles git commands for GitLab
and modifies the list of authorized keys.

WWW: https://gitlab.com/gitlab-org/gitlab-shell

Something seems wrong with the permissions of the first directories checked, can you confirm ?

Greetings,
Mathias
Comment 3 Torsten Zühlsdorff 2016-04-11 12:22:38 UTC
(In reply to Mathias B. from comment #2)

> Something seems wrong with the permissions of the first 
> directories checked, can you confirm ?

Not really. There was an error which wrong permissions of the hooks in gitlab-shell, but you clearly use the already fixed ones.

Can you have a look at /usr/local/www/gitlab/logs? There are various logfiles written by GitLab. Maybe they can give as a clue.
Comment 4 Mathias B. 2016-04-11 12:51:12 UTC
(In reply to Torsten Zühlsdorff from comment #3)
Sadly there is nothing interesting in production.log and sidekiq.log :-(
Comment 5 Torsten Zühlsdorff 2016-04-11 13:10:43 UTC
(In reply to Mathias B. from comment #4)

> Sadly there is nothing interesting in production.log and sidekiq.log :-(

You do not use the default configuration, do you?

I registered an account at the provided link and created a repository. 

I could not even clone a repository via HTTPS or SSH:

$ git clone https://git.unixcorn.org/Zuehlsdorff/test.git
Klone nach 'test' ...
Username for 'https://git.unixcorn.org': 
Password for 'https://Zuehlsdorff@git.unixcorn.org': 
fatal: Authentication failed for 'https://git.unixcorn.org/Zuehlsdorff/test.git/'

$ git clone git@unixcorn.org:Zuehlsdorff/test.git
Klone nach 'test' ...
The authenticity of host 'unixcorn.org (62.210.123.14)' can't be established.
ECDSA key fingerprint is 98:96:05:bb:cb:9a:b1:77:75:e3:f1:49:4e:09:8e:97.
No matching host key fingerprint found in DNS.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'unixcorn.org' (ECDSA) to the list of known hosts.
Password for git@hulk:
Password for git@hulk:
Password for git@hulk:
Permission denied (publickey,keyboard-interactive).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

That is very suspicious and clearly works out of the box for me.

I fear it is not possible to get deeper into this without having a look at the machine itself. :/
Comment 6 Torsten Zühlsdorff 2016-04-11 13:17:03 UTC
I'm sorry - i could clone the repository. Now i can reproduce the error:

$ git push -u origin master
Enter passphrase for key '/home/thorny/.ssh/id_rsa': 
Zähle Objekte: 3, Fertig.
Schreibe Objekte: 100% (3/3), 231 bytes | 0 bytes/s, Fertig.
Total 3 (delta 0), reused 0 (delta 0)
remote: GitLab: The project you were looking for could not be found.
To git@unixcorn.org:Zuehlsdorff/test.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: Fehler beim Versenden einiger Referenzen nach 'git@unixcorn.org:Zuehlsdorff/test.git'

Next idea:
What is the content of /var/log/gitlab-shell?
Comment 7 Mathias B. 2016-04-11 13:19:09 UTC
(In reply to Torsten Zühlsdorff from comment #6)
No problem, thank you very much for helping.

There is the content of the log file suggested (since you register):

I, [2016-04-11T15:04:39.107973 #19741]  INFO -- : Adding project Zuehlsdorff/test.git at </home/git/repositories/Zuehlsdorff/test.git>.
I, [2016-04-11T15:04:39.113447 #19741]  INFO -- : Moving existing hooks directory and symlinking global hooks directory for /home/git/repositories/Zuehlsdorff/test.git.
I, [2016-04-11T15:04:39.804357 #19743]  INFO -- : Adding project Zuehlsdorff/test.wiki.git at </home/git/repositories/Zuehlsdorff/test.wiki.git>.
I, [2016-04-11T15:04:39.809732 #19743]  INFO -- : Moving existing hooks directory and symlinking global hooks directory for /home/git/repositories/Zuehlsdorff/test.wiki.git.
I, [2016-04-11T15:13:49.436553 #19821]  INFO -- : Adding key key-4 => "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDXgrbZrbTy2BNhFnZ2UXZPrLfdXcvOj8+n8UkaKChufd1/YxbjACF5cFXYO//O6o8hjlrWaPZQOARoj2sydtSQhMiw7zi5zD3sZtPKzrAtBWM+KqMy/bPsm/QMtPl0SPhxSmeQKZ167344NjFDhJex0pb3FhRvaa8dcjNzU5luvXuAnhLLBWPZR+8/b1qivlV88YgRveb4DXQ22D1H+RaYrDwaSK4NYehohn9tuvDnytfh3etZlzjXDAsLU9U2Qk4Fi/LU7srb1+6ilS3mSt8geEUtte9FY+t7kwEOJB48Zz5p5ZVCTdhhIAELB+0Fz8irfHUXTLMc2HjLRbWWymWR thorny@hera"
I, [2016-04-11T15:14:42.263884 #19827]  INFO -- : GET http://localhost:8080/api/v3/internal/discover?key_id=4 1.20685
I, [2016-04-11T15:15:10.342534 #19849]  INFO -- : POST http://localhost:8080/api/v3/internal/allowed 1.24163
I, [2016-04-11T15:15:10.342660 #19849]  INFO -- : gitlab-shell: executing git command <git-upload-pack /home/git/repositories/Zuehlsdorff/test.git> for user with key key-4.
I, [2016-04-11T15:15:37.518898 #19863]  INFO -- : POST http://localhost:8080/api/v3/internal/allowed 0.02636
I, [2016-04-11T15:15:37.519092 #19863]  INFO -- : gitlab-shell: executing git command <git-receive-pack /home/git/repositories/Zuehlsdorff/test.git> for user with key key-4.
I, [2016-04-11T15:15:37.665611 #19867]  INFO -- : POST http://localhost:8080/api/v3/internal/allowed 0.00890
I, [2016-04-11T15:16:16.383018 #19877]  INFO -- : GET http://localhost:8080/api/v3/internal/discover?key_id=3 1.26858
I, [2016-04-11T15:17:00.514028 #19889]  INFO -- : POST http://localhost:8080/api/v3/internal/allowed 0.02920
I, [2016-04-11T15:17:00.514241 #19889]  INFO -- : gitlab-shell: executing git command <git-upload-pack /home/git/repositories/matunixe/archlinux-on-macbook_air.git> for user with key key-3.
Comment 8 Torsten Zühlsdorff 2016-04-11 13:36:18 UTC
I did find a greater number of issue-reports with this error message, but all seems to be older and a problem of GitLab itself.

Last try:

Please create a new repostiory, clone it and than try to push it. And provide the full production.log for these actions. Hopefully this gave us some clues. Otherwise just the project itself can help.
Comment 9 Mathias B. 2016-04-11 13:41:24 UTC
(In reply to Torsten Zühlsdorff from comment #8)

I created a repo named "tester", there is the full production.log (I didn't see anything not normal):



Started GET "/" for 81.64.129.130 at 2016-04-11 15:37:05 +0200

Processing by RootController#index as HTML

Read fragment views/namespaces/3-20160410142322039080000/projects/1-20160410173642599506000/root/index/application_settings/1-20160410190932055824000/v2.2/8b33c854a46dcf7f6d598c9a827c46de (0.1ms)

Write fragment views/namespaces/3-20160410142322039080000/projects/1-20160410173642599506000/root/index/application_settings/1-20160410190932055824000/v2.2/8b33c854a46dcf7f6d598c9a827c46de (0.2ms)

Completed 200 OK in 381ms (Views: 153.0ms | ActiveRecord: 20.6ms)

Started GET "/projects/new" for 81.64.129.130 at 2016-04-11 15:37:07 +0200

Processing by ProjectsController#new as HTML

Completed 200 OK in 355ms (Views: 185.2ms | ActiveRecord: 15.9ms)

Started POST "/projects" for 81.64.129.130 at 2016-04-11 15:37:12 +0200

Processing by ProjectsController#create as HTML

Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "project"=>{"namespace_id"=>"3", "path"=>"tester", "import_url"=>"", "description"=>"", "visibility_level"=>"0"}}

Redirected to https://git.unixcorn.org/matunixe/tester

Completed 302 Found in 2075ms (ActiveRecord: 200.6ms)

Started GET "/matunixe/tester" for 81.64.129.130 at 2016-04-11 15:37:15 +0200

Processing by ProjectsController#show as HTML

Parameters: {"namespace_id"=>"matunixe", "id"=>"tester"}

Completed 200 OK in 644ms (Views: 391.5ms | ActiveRecord: 33.7ms)

Started POST "/api/v3/internal/allowed" for 127.0.0.1 at 2016-04-11 15:37:27 +0200

Started POST "/api/v3/internal/allowed" for 127.0.0.1 at 2016-04-11 15:38:24 +0200

Started POST "/api/v3/internal/allowed" for 127.0.0.1 at 2016-04-11 15:38:25 +0200

Started GET "/matunixe/tester/edit" for 81.64.129.130 at 2016-04-11 15:38:31 +0200

Processing by ProjectsController#edit as HTML

Parameters: {"namespace_id"=>"matunixe", "id"=>"tester"}

Completed 200 OK in 409ms (Views: 175.1ms | ActiveRecord: 19.2ms)

Started GET "/admin" for 81.64.129.130 at 2016-04-11 15:38:33 +0200

Processing by Admin::DashboardController#index as HTML

Completed 200 OK in 337ms (Views: 169.5ms | ActiveRecord: 22.0ms)

Started GET "/admin/logs" for 81.64.129.130 at 2016-04-11 15:38:36 +0200

Processing by Admin::LogsController#show as HTML
Comment 10 Torsten Zühlsdorff 2016-04-11 15:14:37 UTC
You are right - there is nothing suspicious in the logfiles :(

Since it is already broken: would you like to test the patch for the next version? You can find it here:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=208511

Maybe it solves the problem. If not, this would be a good base for an issue at https://gitlab.com/gitlab-org/gitlab-ce/issues/.

I will let the PR open. Maybe we find a solution or new idea to try later. I'm sorry i couldn't help any further.
Comment 11 Mathias B. 2016-04-11 15:51:34 UTC
Hey Torsten,

Thanks for answering again. :-)
I upgraded with the provided patch, everything works well except the problem we found before.

I'll go open a bug report in the official gitlab repo.
Bye!
Comment 12 Torsten Zühlsdorff 2016-04-11 15:54:58 UTC
Can you provide the link to the issue? I like to follow ;)
Comment 13 Mathias B. 2016-04-11 15:56:53 UTC
(In reply to Torsten Zühlsdorff from comment #12)
Of course, there it is: https://gitlab.com/gitlab-org/gitlab-ce/issues/15143
Comment 14 Mathias B. 2016-04-14 11:26:16 UTC
Meh, nobody cares. :(
Comment 15 Torsten Zühlsdorff 2016-04-18 08:40:12 UTC
(In reply to Mathias B. from comment #14)

> Meh, nobody cares. :(

You can also try it at:
https://github.com/gitlabhq/gitlabhq/

There is often more response (but not always).
Comment 16 Kurt Jaeger freebsd_committer freebsd_triage 2016-05-05 17:30:08 UTC
Did any of the newer versions (8.5.12 or 8.7.2) fix the issue ?
Comment 17 Mathias B. 2016-05-06 06:37:40 UTC
(In reply to Kurt Jaeger from comment #16)
Hey, thanks for questioning. I didn't try, I needed a Gitlab instance running quickly. So I setup a Debian guest on my hypervisor...
As I'm unable to debug further I think we can close this bug, no?
Comment 18 Gabor 2016-05-06 20:53:50 UTC
Hi guys,

I found a solution to this issue, as I had exactly the same problem with a fresh install on Freebsd 10.

I needed to change the following things:
repo_path in gitlab-shell config.yml to /usr/home/git/repositories
repos_path in gitlab gitlab.yml to /usr/home/git/repositories/

It is because the default value /home is a symlink on Freebsd. After this the system works flawlessly.
Comment 19 Torsten Zühlsdorff 2016-05-18 14:31:30 UTC
(In reply to Gabor from comment #18)

> It is because the default value /home is a symlink on Freebsd. 
> After this the system works flawlessly.

After reading this, i think you are right. There is a big warning about symlinks above the pathes and i wasn't aware about the home-symlink. 

Attached a patch with a proposed solution. Please test it and give feedback.
Comment 20 Torsten Zühlsdorff 2016-05-18 14:32:14 UTC
Created attachment 170448 [details]
patch with patched config for devel/gitlab-shell and www/gitlab
Comment 21 Torsten Zühlsdorff 2016-05-31 15:07:26 UTC
Created attachment 170874 [details]
patch to update gitlab-shell
Comment 22 Torsten Zühlsdorff 2016-05-31 15:12:40 UTC
I did the test by myself and the patch worked. :)

I added a patch for devel/gitlab-shell to fix the issue. The patch for www/gitlab will be contained in the update for GitLab itself.

Greetings,
Torsten
Comment 23 Gabor 2016-05-31 21:47:00 UTC
Sorry mate, I didn't had the chance to test it, but I trust in you :)
Comment 24 commit-hook freebsd_committer freebsd_triage 2016-06-02 06:15:35 UTC
A commit references this bug:

Author: pi
Date: Thu Jun  2 06:15:01 UTC 2016
New revision: 416268
URL: https://svnweb.freebsd.org/changeset/ports/416268

Log:
  devel/gitlab-shell: fix the supplied example file for /usr/home

  PR:		208693
  Submitted by:	Torsten Zuehlsdorff <ports@toco-domains.de> (maintainer)

Changes:
  head/devel/gitlab-shell/Makefile
  head/devel/gitlab-shell/files/patch-config.yml.example
Comment 25 Kurt Jaeger freebsd_committer freebsd_triage 2016-06-02 06:15:56 UTC
Committed, thanks!