使用Rake task

將user_name改成要變更密碼的user name即可

sudo gitlab-rake "gitlab:password:reset[user_name]"

使用Rails console

  1. 開啟rails console
sudo gitlab-rails console
  1. 取得user
    1. 透過username
    user = User.find_by_username 'user_name'
    
    1. 透過userID
    user = User.find(uid)
    
    1. 透過email
    user = User.find_by(email: 'user@example.com')
    
  2. 重置密碼
new_password = 'my_new_password' 
user.password = new_password 
user.password_confirmation = new_password
  1. 儲存修改
user.save!
  1. 退出console
exit