GitLab重置root密码

转载:http://blog.sina.com.cn/s/blog_6594d5d30102whsf.html

 

英文原文请参见
http://docs.gitlab.com/ce/security/reset_root_password.html#how-to-reset-your-root-password

部分翻译后如下

 

Log into your server with root privileges. Then start a Ruby on Rails console.

Start the console with this command: (切换到root账户后)

gitlab-rails console production

Wait until the console has loaded. (稍等一下)

There are multiple ways to find your user. You can search for email or username. (方法1)

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

or (方法2)

user = User.find_by(email: 'admin@local.host')

Now you can change your password: (找出账户后可以修改密码,注意至少8位)

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.

 

posted on 2016-12-16 18:11  傻子才悲伤  阅读(443)  评论(0编辑  收藏  举报

导航