Using GitLab behind nginx enabled basic_auth?

basic-authentication, gitlab, nginx

Solution

Add this to `/etc/gitlab/gitlab.rb`:

nginx['custom_gitlab_server_config'] = "auth_basic 'Restricted';\n  auth_basic_user_file htpasswd;\n"

And run `gitlab-ctl reconfigure`

Problem

I've successfully installed GitLab for management of private repositories (it's quite awesome!). The problem I am having is by default, Gitlab login is presented when anyone hits my subdomain. I would like to protect the entire area with a basic_auth layer before the user gets the GitLab login screen. Unfortunately, this breaks my ability to push/pull from GitLab when it's enabled. my nginx config to enable basic_auth: ``` auth_basic "Restricted"; auth_basic_user_file htpasswd; ``` Any ideas on how I can enable basic_auth without breaking git / gitlab functionality?

Original source