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.
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
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
- Setup git https://docs.gitlab.com/ee/gitlab-basics/start-using-git.html
- Ensure that your profile has either a SSH public key (SSH clone) or https access tokens - youāll need this as authentication layer when cloning the repository.
- Learn more about pull/push then for keeping changes in sync.
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.