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

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.