How to setup admin user with gitlab with LDAP authentication?
Mine is a variant of the accepted answer but it's based on an example from the official documentation
From the command line of your gitlab server:
Open the gitlab rails console (I'm assuming here that you aren't logged in as root):
sudo gitlab-rails console production
Then type the following commands:
user = User.find_by(username: 'my_username')
user.admin = true
user.save!
Close the console:
exit
Update your gitlab server:
sudo gitlab-ctl reconfigure
This is what I did to make a LDAP (or Windows AD) user vikas as admin.
First login on GitLab portal and logout, then run the below commands.
gitlab-rails console production
u = User.where(id: 1).first
u.admin = true
u.save!
exit
After running the above commands, login again and now your will have admin privileges for vikas AD user.
You can also set admin permissions to a user by doing something like this in the rails console:
User.find_by_email("[email protected]") do |i|
i.admin = true
i.save
end