云计算运维

Windows Server 2003 - Windows Server 2019 系统工具,Linux系统脚本,Mysql、Nginx、PHP、Redis、K8S、Seafile、Weblogic 、Jenkins、DNS、DHCP、FTP、IIS、Zookeeper、Rabbitmq、Oracle、Tomcat、Mavrn等服务搭建维护,请关注我.

gitlab重置密码


官方文档传送门

How to reset your root password
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

Wait until the console has loaded.

There are multiple ways to find your user. You can search for email or username.

user = User.where(id: 1).first

or

user = User.find_by(email: 'admin@example.com')

Now you can change your password:

user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'

It’s important that you change both password and password_confirmation to make it work.

Don’t forget to save the changes.

user.save!

Exit the console and try to login with your new password.

Help and feedback

K8S的执行方法如下

# 假如那么namespace是 gitlab

kubectl -n gitlab exec -it $(kubectl -n gitlab  get po -l "app=task-runner" -oname) /bin/bash

# 进入容器执行gitlab-rails

/usr/local/bin/gitlab-rails console -e production

user = User.find_by(email: 'admin@example.com')
user.password = 'secret_pass'
user.password_confirmation = 'secret_pass'
user.save!
  • 分享:
评论
还没有评论
    发表评论 说点什么