搭建了一个gitlab的git服务器,默认的管理员为root;html
长时间不用root忘记了root密码;git
咱们能够在服务器上直接重置root的密码;bash
如下操做在终端下执行服务器
#进入gitlab控制台 sudo gitlab-rails console production #获取root用户 user = User.where(id: 1).first #设置新密码,注意新密码要大于8位 user.password = newPwd #再次确认新密码 user.password_confirmation = newPwd #保存密码 user.save!
参考:https://docs.gitlab.com/ce/security/reset_root_password.htmlgitlab