Gitlab 修改密碼
gitlab 修改密碼
使用Rake task
將user_name改成要變更密碼的user name即可
sudo gitlab-rake "gitlab:password:reset[user_name]"
使用Rails console
- 開啟rails console
sudo gitlab-rails console
- 取得user
- 透過username
user = User.find_by_username 'user_name'
- 透過userID
user = User.find(uid)
- 透過email
user = User.find_by(email: 'user@example.com')
- 重置密碼
new_password = 'my_new_password'
user.password = new_password
user.password_confirmation = new_password
- 儲存修改
user.save!
- 退出console
exit