LoginSignup
34

More than 5 years have passed since last update.

Gitlabのrootユーザー(admin)のパスワードを忘れてしまった場合

Last updated at Posted at 2016-04-01

Gitlabのrootユーザー(admin)のパスワードを忘れてしまった場合

GitlabCEのrootユーザー(admin)のパスワードを忘れてしまったため、
コンソールから強制的にパスワードリセットを実施した時のメモです。

環境

  • CentOS67
  • GitLab 7.14.1 481c966 Check

手順

Gitlabをインストールしたアカウントかサーバのrootアカウントで
サーバへsshログインして以下コマンドを実行します。

  1. gitlab-rails console production # コンソール起動(少しが時間かかります。)
  2. user = User.where(id: 1).first # rootアカウント設定モードへ
  3. user.password = 'secret_pass' # 新パスワード設定
  4. user.password_confirmation = 'secret_pass' # 新パスワード設定(確認)
  5. user.save! # 設定の保存
  6. exit # コンソールを抜ける

実行結果

[root@gitlab_server ~]# gitlab-rails console production
Loading production environment (Rails 4.1.11)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id: 1, email: "admin@example.com", 
中略
public_email: "", dashboard: 0, project_view: 0>
irb(main):002:0> user.password = 'password'
=> "password"
irb(main):003:0> user.password_confirmation = 'password'
=> "password"
irb(main):004:0> user.save!
=> true
irb(main):005:0> exit
[root@gitlab_server ~]# 

参考

How to reset your root password

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34