• 重置gitlab管理员密码


    gitlab web管理员登录密码忘记以后可以用如下方式修改密码(本演示系统为Linux-CentOS6.6):

    [root@localhost ~]# gitlab-rails console production
    Loading production environment (Rails 4.2.7.1)
    irb(main):001:0> user=User.where(id:1).first //id为1的是超级管理员

    敲回车键

    => #<User id: 1, email: "admin@example.com", created_at: "2017-02-09 11:03:08", updated_at: "2017-02-15 12:19:54", name: "Administrator", admin: true, projects_limit: 10, skype: "", linkedin: "", twitter: "", authentication_token: "M_ffJi-sRksyrz_dexor", theme_id: 2, bio: nil, username: "root", can_create_group: true, can_create_team: false, state: "active", color_scheme_id: 1, password_expires_at: nil, created_by_id: nil, last_credential_check_at: nil, avatar: 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, otp_grace_period_started_at: nil, ldap_email: false, external: false, organization: nil, incoming_email_token: "dten2iwvt5zcm2su3280mybbo", authorized_projects_populated: true>

    (注:红色部分标出管理员登录名)

    irb(main):002:0>user.password = 'yourpassword' //密码必须至少8个字符

    敲回车键
    irb(main):003:0>user.save!

    敲回车键

    irb(main):003:0> user.save!
    Enqueued ActionMailer::DeliveryJob (Job ID: 99d8a108-2f13-4bdf-9ccc-d23d43d7a1c0) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", gid://gitlab/User/1
    => true

     // 如没有问题 返回true

    至此密码修改完成,可以用管理员名和修改好后的密码登陆了。

  • 相关阅读:
    Python基础教程:多线程运行带多个参数的函数
    Python基础教程:list相关操作
    python字典教程:setdefault方法和get方法
    Python 异常处理集合
    python基础教程:5个带key的python内置函数
    python操作Excel的5种方式
    Python3压缩和解压缩实现
    jenkins 分布式配置主从节点
    CentOS7 free字段含义
    nginx配置https
  • 原文地址:https://www.cnblogs.com/IT-Crowd/p/6412229.html
Copyright © 2020-2023  润新知