多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# How to reset your root password > 原文:[https://docs.gitlab.com/ee/security/reset_root_password.html](https://docs.gitlab.com/ee/security/reset_root_password.html) # How to reset your root password[](#how-to-reset-your-root-password "Permalink") 要重置您的 root 密码,请首先使用 root 特权登录到服务器. 使用以下命令启动 Ruby on Rails 控制台: ``` gitlab-rails console -e production ``` 等待控制台加载完毕. 有多种找到用户的方法. 您可以搜索电子邮件或用户名. ``` user = User.where(id: 1).first ``` or ``` user = User.find_by(email: 'admin@example.com') ``` 现在,您可以更改密码: ``` user.password = 'secret_pass' user.password_confirmation = 'secret_pass' ``` 更改 password 和 password_confirmation 以使其正常工作很重要. 不要忘记保存更改. ``` user.save! ``` 退出控制台,然后尝试使用新密码登录.