Git/GitLab
< Git
Jump to navigation
Jump to search
Reset a user password
This could be also root user.
ubuntu@gitlab:~$ sudo gitlab-rails console ------------------------------------------------------------------------------------- GitLab: 11.4.0 (6ebbd70) GitLab Shell: 8.3.3 postgresql: 9.6.8 ------------------------------------------------------------------------------------- Loading production environment (Rails 4.2.10) irb(main):001:0> user = User.find_by(username: "bob") user = User.find_by(id: 1) //by id => #<User id:5 @bob> irb(main):002:0> user.password = 'test1234' //at least 8 characters long => "test1" irb(main):003:0> user.password_confirmation = 'test1234' => "test1" irb(main):007:0> user.unlock_access! => true irb(main):008:0> user.save! => false