Gitlab is installed on the server, I want to allow access to repositories via ssh only. Thus, only those people whose keys I added to their gitlab profiles can work on the project. In gitlab.rb I did not find such an option. Is it possible to make such a restriction?

  • And why not use a regular privilege system? - tonal
  • one
    In your case, I think, the easiest way is to configure nginx so that at a certain URL it gives 403. - etki
  • @Etki, what will the config look like? can unsubscribe in the answer? Should there be something like a mask giving 403 to all addresses ending in .git ? Or is it tough? - sanu0074
  • @ sanu0074 yes, stupidly by the pattern match. You hardly have strong traffic going there, so it shouldn’t have a particular impact on speed. I can not write the config myself now. - etki
  • @Etki, for some reason, location ~ ^ /. Git $ {return 403; } - sanu0074

1 answer 1

It’s not possible to do this with standard GitLab tools. There is an open Issue in Gitlab'e Gitlab'a, but so far so no one is itching.
As a temporary crutch, there is such a solution , but I, like its author, do not recommend changing the application code.

UPD : here is a curious suggestion to turn off the gitlab-workhorse (it appeared from version 8 with something, if memory serves me right), unfortunately I can't try it, the service is in production, but if you have the opportunity, it may work

  • When gitlab-workhorse is disabled ( gitlab_workhorse['enable'] = false ) - it’s impossible to log in to gitlab itself, I receive a bad request - sanu0074
  • @ sanu0074 if this is omnibus, then how everything is arranged there, I don’t know, but everything worked on my manually installed gitlab when the girlab-workhorse was not started - andreymal
  • @andreymal and about the same, just all the settings live in /etc/gitlab/gitlab.rb ; gitlab_workhorse['enable'] parameter, change true to false and run sudo gitlab-ctl reconfigure - beheerder
  • @beheerder, I have an omnibus, so I just changed it to true, and it went down - sanu0074