GitLab Reset Password


Have you forgotten your GitLab password? What about your GitLab root user password? Not to worry, I'm going to show you exactly how to do a GitLab reset password operation.

And as this is from the command line, you won't need to have email set up, or remember the email address you registered with.

GitLab Default Password

First up, if you were naughty and didn't change your GitLab default password then try these:

  • Username: root
  • Password: 5iveL!fe

If that works, make changing the root password your immediate next task.

GitLab Password Reset

If you have email set up on your GitLab server, the password reset link should see you right.

If you haven't got email set up, or you forgot your root password, then these steps should get you back in:

Start by connecting to your GitLab server via ssh.

Then if you are using the GitLab CE Omnibus Edition:

sudo gitlab-rails console production

Or, if that doesn't work - or you know you installed from source (or, potentially, are using a Docker image):

sudo -u git -H bundle exec rails console production

Then from here, the steps should be the same:

u = User.where(id:1).first
u.password = 'your_new_password'
u.password_confirmation = 'your_new_password'
u.save!

You must update both the password and password_confirmation fields.

Probably the most important part is getting that exclamation mark in at the end, or this won't work.

After that, you should be good to log back in.

None Root User GitLab Password Reset

If you know your email address, you can instead change the procedure to:

sudo gitlab-rails console production # or source method, as shown above
u = User.find_by(email: 'you@your.email')
u.password = 'your_new_password'
u.password_confirmation = 'your_new_password'
u.save!

And you should be good to go.

Episodes