Modified /etc/gitlab/gitlab.rb with the following configuration.
indent preformatted text by 4 spacesgitlab_rails[‘ldap_enabled’] = true
gitlab_rails[‘ldap_servers’] = YAML.load <<-EOS # remember to close this block with ‘EOS’ below
main: # ‘main’ is the GitLab ‘provider ID’ of this LDAP server
I was having the same issue and the resolution for me was proper white space in the gitlab.yml under the LDAP section. In fact, I’m using the omnibus installation so I made my configuration file changes in the /etc/gitlab/gitlab.rb file and then run gitlab-ctl reconfigure to generate the gitlab.yml.
I traced the cause of my problem though the unicorn std-err log which pointed to the file /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb
The error message was:
/opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:108:in block in <top (required)>': undefined method ’ for nil:NilClass (NoMethodError)
from /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:107:in each' from /opt/gitlab/embedded/service/gitlab-rails/config/initializers/1_settings.rb:107:in <top (required)>’
from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/dependencies.rb:241:in load' from /opt/gitlab/embedded/service/gem/ruby/2.1.0/gems/activesupport-4.1.12/lib/active_support/dependencies.rb:241:in block in load’
from /opt/gitlab/embedded/service/gem/ruby/2.1.0
The code under this section is looking at the ldap settings. In googled the error message and I found a reference to proper white space settings in the gitlab.yml file. I indented the section as follows (spaces, not TABS):
main: # ‘main’ is the GitLab ‘provider ID’ of this LDAP server
label: ‘LDAP’
host: ‘my_ad.mycorp.com’
port: 389
uid: ‘sAMAccountName’
method: ‘plain’ # “tls” or “ssl” or “plain”
bind_dn: ‘CN=svn bind,OU=Service Accounts,OU=RAL,OU=Users,OU=ID,DC=IDCorp,DC=com’
password: ‘xxx’
base: ‘OU=Users,OU=ID,DC=IDCorp,DC=com’
the post stripped my white space in the configuration file section above
gitlab_rails['ldap_enabled'] = true
gitlab_rails['ldap_servers'] = YAML.load <<-'EOS' # remember to close this block with 'EOS' below
main: # 'main' is the GitLab 'provider ID' of this LDAP server
label: 'LDAP'
host: 'my_ad.mycorp.com'
port: 389
uid: 'sAMAccountName'
method: 'plain' # "tls" or "ssl" or "plain"
bind_dn: 'CN=svn bind,OU=Service Accounts,OU=RAL,OU=Users,OU=ID,DC=IDCorp,DC=com'
password: 'xxx'
base: 'OU=Users,OU=ID,DC=IDCorp,DC=com'
EOS