Detailed explanation of CICD (14) - Gitlab forgotten password recovery

Today, I will continue to introduce the relevant knowledge of Linux operation and maintenance. The main content of this article is the recovery of gitlab after forgetting the password.
Sometimes, because we haven't used Gitlab for a long time, we forget the password of the administrator user, which leads to the situation that we cannot log in to the system, or because of a system bug, after the initial installation of Gitlab, the page for setting the password does not appear, but appears directly. The login page is displayed, so that we cannot continue to use the login configuration. In this case, we need to reset the password of Gitlab.
First, on the Gitlab device, execute the command:

gitlab-ce console -e production

Enter the console of Gitlab and the result is as follows:
insert image description here
After that, we execute the command:

user=User.where(id:1).first
user.password=‘12345678’
user.password_confirmation='12345678'
user.save

In the above configuration, the first command means to select the user. Since the administrator user root is the first user, the user id is 1; the second command means to set the root user's password, and the third command means to confirm the root user's password. Password, the fourth command means to save the previous settings and make them take effect. The execution process of the above command is as follows:
insert image description here
In this way, after completing the above configuration, restart gitlab, and you will find that the password has been reset to the value we set!
Originality is not easy, please indicate the source for reprinting: https://blog.csdn.net/weixin_40228200

Guess you like

Origin blog.csdn.net/weixin_40228200/article/details/123890757
Recommended