搭建了一個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