by Devin Yang
(This article was automatically translated.)

Published - 3 years ago ( Updated - 3 years ago )


The gitlab built with docker has been useless for a long time, and I forgot the password, how to reset it.

We should be able to enter the gitlab container through the following command
docker exec -ti gitlab bash
Then execute the following command to reset: Please wait for the execution to complete.
1. Execute the following commands as root to enter the Ruby on Rails console.
gitlab-rails console -e production
Second, catch the first user.
user = User.where(id: 1).first
Enter user to view the name again
irb(main):003:0> user
=> #<User id:1 @root>
Enter user.eamil to get mailbox
irb(main):010:0> user = User.where(id: 6).first
=> #<User id:6 @thor>
irb(main):011:0> user.email
=> "thor@avengers.test"
irb(main):012:0>

Or get the user by email
user = User.find_by(email: 'thor@avengers.test')
To change the password, execute
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'
Finally, save and press Ctrl+d to leave.
user. save!

The following is an actual execution example:


If you don't know how to configure GitLab with docker, you can refer to the link below:
https://www.ccc.tc/article/docker-and-gitlab

Tags: gitlab reset password

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments