Gitlab系列八之重置管理员密码

gitlab web登入密码忘记以后可以用如下方式修改密码

[root@gitlat-test gitlab]# gitlab-rails console production
Loading production environment (Rails 4.2.6)

irb(main):001:0> user = User.where(id: 1).first //id为1的是超级管理员

irb(main):001:0> user = User.where(id: 1).first
=> #<User id: 1, email: "admin@example.com", encrypted_password: "$2a$10$3sQjUs2XgoSN63xnR4La5eYU3vHxpHD66xf./Z46Bd2...", reset_password_token: nil, reset_password_sent_at: nil, remember_created_at: nil, sign_in_count: 0, current_sign_in_at: nil, last_sign_in_at: nil, current_sign_in_ip: nil, last_sign_in_ip: nil, created_at: "2017-06-27 07:23:03", updated_at: "2017-06-27 07:28:36", name: "Administrator", admin: true, projects_limit: 10, skype: "", linkedin: "", twitter: "", authentication_token: "tnxo3F3_QCqQScbpMWjQ", theme_id: 2, bio: nil, failed_attempts: 0, locked_at: nil, username: "root", can_create_group: true, can_create_team: false, state: "active", color_scheme_id: 1, notification_level: 1, password_expires_at: nil, created_by_id: nil, last_credential_check_at: nil, avatar: nil, confirmation_token: nil, confirmed_at: "2017-06-27 07:23:04", confirmation_sent_at: nil, unconfirmed_email: nil, hide_no_ssh_key: false, website_url: "", notification_email: "admin@example.com", hide_no_password: false, password_automatically_set: false, location: nil, encrypted_otp_secret: nil, encrypted_otp_secret_iv: nil, encrypted_otp_secret_salt: nil, otp_required_for_login: false, otp_backup_codes: nil, public_email: "", dashboard: 0, project_view: 0, consumed_timestep: nil, layout: 0, hide_project_limit: false, unlock_token: nil, otp_grace_period_started_at: nil, ldap_email: false, external: false>

irb(main):002:0>user.password = 'yourpassword' //密码必须至少8个字符
irb(main):003:0>user.save! // 如没有问题 返回true

密码修改完成,去登陆吧!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值