美文网首页
gitlab忘记密码

gitlab忘记密码

作者: 疯狂撸代码的奋青骚年 | 来源:发表于2021-04-29 10:47 被阅读0次

1.进入到gitlab 的ssh命令行

root@03cbecccf5c8:/# 

2.登录到Gitlab服务器

root@03cbecccf5c8:/# gitlab-rails console production

如果执行上面的指令提示

Traceback (most recent call last):
    8: from bin/rails:4:in `<main>'
    7: from bin/rails:4:in `require'
    6: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    5: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/command.rb:46:in `invoke'
    4: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/command/base.rb:69:in `perform'
    3: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    2: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    1: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/commands/console/console_command.rb:95:in `perform': wrong number of arguments (given 1, expected 0) (ArgumentError)
    9: from bin/rails:4:in `<main>'
    8: from bin/rails:4:in `require'
    7: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/commands.rb:18:in `<top (required)>'
    6: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/command.rb:46:in `invoke'
    5: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/railties-6.0.2/lib/rails/command/base.rb:69:in `perform'
    4: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
    3: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
    2: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:20:in `run'
    1: from /opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/command.rb:34:in `rescue in run'
/opt/gitlab/embedded/lib/ruby/gems/2.6.0/gems/thor-0.20.3/lib/thor/base.rb:506:in `handle_argument_error': ERROR: "rails console" was called with arguments ["production"] (Thor::InvocationError)
Usage: "rails console [options]"

则可能是Gitlab版本不一样,然后参数方式不一样,需要用如下方式:

root@03cbecccf5c8:/# gitlab-rails console -e production

3.查询用户

> user = User.where(username:"root").first
=> #<User id:1 @root>

4.修改密码

> user.password = "qwer1234"
=> "qwer1234"

5.保存

> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 1f015e02-34bc-4b26-8e37-3101937b7ce1) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007fa6b83b1378 @uri=#<URI::GID gid://gitlab/User/1>>
=> true

6.登录

账号:root
密码:qwer1234

相关文章

  • gitlab忘记密码

    1.进入到gitlab 的ssh命令行 2.登录到Gitlab服务器 如果执行上面的指令提示 则可能是Gitlab...

  • gitlab忘记密码终极方案

    方案一 谷歌浏览器-查看密码 如果是忘记git的密码,但是浏览器还可以登陆,谷歌浏览器还“记得”密码,那么可以: ...

  • 忘记gitlab的管理员名称和密码的解决方案

    问题说明 一段时间没有访问gitlab,gitlab的管理员和密码都忘记了。 解决方案 进入rails控制台 查询...

  • GitLab 迁移

    Gitlab 修改普通用户密码 Gitlab 创建备份 使用Gitlab一键安装包安装Gitlab非常简单, 同样...

  • Gitlab忘记root密码怎么办

    切换目录:cd /opt/gitlab/bin 然后: 接着查询一下用户: 然后修改密码: 然后保存: 保存之后,...

  • Git篇:Git重置管理员root密码

    01 前言 最近因工作需要需使用Gitlab管理员账户及root,但是忘记密码了,衰。。。。 以下是找回过程,做个...

  • docker 安装gitlab

    docker pull gitlab/gitlab-ce 创建目录 启动脚本 修改root 用户密码 打开网页登录...

  • GIT多人协作开发步骤总结

    写在最前端 我使用的存放git代码的工具是GitLab,记得需要和公司要GitLab的账号和密码。关于GitLab...

  • docker部署gitlab

    docker部署gitlab 下载镜像 运行容器 修改root用户密码 修改配置 修改gitlab.rb文件配置主...

  • 开发代码流程

    实现项目代码从gitlab到rancher的构建 1.gitlab创建账号密码、创建project&reposit...

网友评论

      本文标题:gitlab忘记密码

      本文链接:https://www.haomeiwen.com/subject/kynbrltx.html