How do I change my profile to Admin?

I would like to know how to change my profile to Admin. There are no good answers in GitLab Help or when googling the topic nor did I find a solution in the FAQ section here on this forum.

Hi,

in the same way as you would reset your root password, following the docs:

Log into the rake console, this may take a while. Also, use with care, this step is performed as root and open heart surgery.

gitlab-rails console -e production

Next, find the user you want to make an administrator. E.g. by email, or any other attribute which fits.

user = User.find_by(email: 'kurt@domain.com')

or 

user = User.find_by(username: 'kurt')

The next step is to change the admin flag and save the changes.

user.admin = true
user.save!

Then leave the console with exit.

Please let me know whether this worked for you.

Kind regards,
Michael

4 Likes

Hi Michael,

What do you mean by ā€œrake consoleā€? Is this a Git Bash console or something else?

Regards,

Kurt

Hi Kurt,

yep, you need to be root on your server to start the rake console. The linked docs outline that a bit better, I did not add it here.

To reset your root password, first log into your server with root privileges.

Start a Ruby on Rails console with this command:

gitlab-rails console -e production

Hope this helps.

Cheers,
Michael

Can I do this in Bash? I do not have Ruby on Rails and I donā€™t want to download and install it.

Thatā€™s available on your GitLab server, just SSH into it and either become root, or do the steps with sudo.

Iā€™m getting an error when I try to run the first command.
Kurt Reynolds@DESKTOP-KRB2775 MINGW64 ~
$ user = User.find_by(email: ā€˜kurt@chocolatey.ioā€™)
bash: syntax error near unexpected token `(ā€™

Kurt Reynolds@DESKTOP-KRB2775 MINGW64 ~
$ sudo user = User.find_by(username: 'kurtreynolds11')
bash: syntax error near unexpected token `('

You need to start the gitlab-rails console with

gitlab-rails console -e production

In there you can run the command user = ....

The command does not work on your bash, thatā€™s ruby on rails syntax.

I received an error while executing this command.

Should I have marked out my Git username and email?

Is this the same server where GitLab is running on?

This looks like a Windows host were you just installed Ruby on Rails for Windows. This is not the way you want to go.

GitLab has to be installed on a Linux server, and over there you can SSH into it, and run the said commands.

Cheers,
Michael

No, I donā€™t have a Linux server. My local cloned repositories run on Windows 10 on my laptop.

I thought you would want to change your GitLab account to become an administrator?

Please clarify on the goal you want to achieve, with some more details please. Iā€™m pretty much confused now.

Cheers,
Michael

Yes, Iā€™m wanting to change my profile to Admin when I log into the GitLab website at gitlab.com.

Hi,

Iā€™m afraid this is not possible. GitLab.com is operated by our infrastructure team. You cannot get administration permissions thus being limited to groups, organisations and projects and their permission system.

If you do want to manage your own instance, you need to install GitLab on-premise, e.g. at a cloud provider, setup a new Ubuntu VM, install GitLab and manage it in there. The physical first account will be root and then you are free to go.

Check back here for more insights and differences:

Cheers,
Michael

Thank you for your help!

Hi,

youā€™re welcome. Can you add some details why you would have needed admin access? Maybe this problem can solved with group permissions :slight_smile:

Cheers,
Michael

I was trying to follow along with some video tutorials on using GitLab. The tutorials demonstrate doing some tasks only an ā€˜Adminā€™ can do. I didnā€™t realize that these videos showed a cloned repo operating on someoneā€™s personal server.

Do you have a link on ā€œHow I can clone GitLab to personal serverā€?

Regards,
Kurt

Hi,

ah, so you have a project on GitLab.com already youā€™d want to now clone to your windows desktop.
Iā€™d recommend to start looking in these steps

If you are asking specifically to clone a project to an existing GitLab server - you could either look into mirroring the repository, or youā€™ll clone the repository from gitlab.com to your desktop, edit the .git/config file with the remote origin pointing to an url entry which you need to change to your personal GitLab server then.

But Iā€™d guess from your question that youā€™ll likely donā€™t have a server, you just mean your Windows client, right?

Cheers,
Michael

Correct. I only have a Windows client running in a VM on my Mac.