gitlab不小心把sign-in取消了怎么恢复
环境和版本
[root@linux-node1 etc]# ll /var/cache/yum/x86_64/7/gitlab-ce/packages/ total 292928 -rw-r--r-- 1 root root 299954157 Apr 22 2017 gitlab-ce-9.1.0-ce.0.el7.x86_64.rpm [root@linux-node1 etc]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) [root@linux-node1 etc]#
问题原因
在配置gitlab的过程中,本来想取消sign-up时,结果看错了,把sign-in的勾去掉了。导致退出之后无法登录
显示如下,不小心把这里的勾去掉了
再次登录提示如下
No authentication methods configured.
尝试的解决方法
1、前期不断试图从配置文件里找出相关的地方,最终没找到有用的配置
下面地方的配置都找过。尤其是gitlab.rb文件。找不到相关配置的地方
[root@linux-node2 etc]# ll /etc/gitlab/ total 76 -rw------- 1 root root 65421 Apr 23 16:32 gitlab.rb -rw------- 1 root root 9713 Apr 10 05:17 gitlab-secrets.json drwxr-xr-x 2 root root 6 Apr 10 05:17 trusted-certs [root@linux-node2 etc]# ll /opt/gitlab/ total 1944 drwxr-xr-x 2 root root 103 Apr 10 05:16 bin drwxr-xr-x 18 root root 4096 Apr 10 05:17 embedded drwxr-xr-x 6 root root 4096 Apr 10 05:18 etc drwxr-xr-x 2 root root 4096 Apr 10 05:19 init -rw-r--r-- 1 root root 1931990 Apr 22 21:36 LICENSE drwxr-xr-x 2 root root 4096 Apr 10 05:16 LICENSES drwxr-xr-x 2 root root 4096 Apr 10 05:19 service drwxr-xr-x 15 root root 4096 Apr 10 05:19 sv drwxr-xr-x 3 root root 20 Apr 10 05:18 var -rw-r--r-- 1 root root 19834 Apr 22 21:36 version-manifest.json -rw-r--r-- 1 root root 8769 Apr 22 21:36 version-manifest.txt [root@linux-node2 etc]# ll /var/opt/gitlab/gitlab-rails/etc total 44 -rw-r--r-- 1 root root 498 Apr 10 05:17 database.yml -rw-r--r-- 1 root root 129 Apr 10 05:17 gitlab_shell_secret -rw-r--r-- 1 root root 45 Apr 10 05:17 gitlab_workhorse_secret -rw-r--r-- 1 root root 14427 Apr 10 05:17 gitlab.yml -rw-r--r-- 1 root root 1383 Apr 10 05:17 rack_attack.rb -rw-r--r-- 1 root root 59 Apr 10 05:17 resque.yml -rw-r--r-- 1 root root 4092 Apr 10 05:17 secrets.yml -rw-r--r-- 1 root root 1611 Apr 10 05:18 unicorn.rb [root@linux-node2 etc]#
尝试修改文件/etc/gitlab/gitlab.rb,在最末尾添加如下,也不起作用
gitlab_rails['gitlab_signin_enabled'] = true
2、尝试卸载gitlab,然后重装
因为本来就是新装的测试环境,尝试卸载gitlab的rpm包,然后删除/opt/gitlab 和/etc/gitlab 目录,重装之后没效果,应该有还有一些目录没删除干净
尝试gitlab-ctl reconfigure 也不起作用
3、网上搜索
链接如下
https://www.libaocai.com/5727.html
解决步骤如下
gitlab-psql gitlabhq_production UPDATE application_settings set signin_enabled=true; \q gitlab-ctl restart
操作过程如下
[root@linux-node1 etc]# gitlab-psql gitlabhq_production could not change directory to "/var/opt/gitlab/gitlab-rails/etc": Permission denied psql (9.6.1) Type "help" for help. gitlabhq_production=# UPDATE application_settings set signin_enabled=true; UPDATE 6 gitlabhq_production-# \q [root@linux-node1 etc]# gitlab-ctl restart ok: run: gitaly: (pid 79247) 1s ok: run: gitlab-monitor: (pid 79254) 0s ok: run: gitlab-workhorse: (pid 79258) 1s ok: run: logrotate: (pid 79268) 0s ok: run: nginx: (pid 79279) 0s ok: run: node-exporter: (pid 79287) 0s ok: run: postgres-exporter: (pid 79294) 1s ok: run: postgresql: (pid 79309) 0s ok: run: prometheus: (pid 79320) 1s ok: run: redis: (pid 79331) 0s ok: run: redis-exporter: (pid 79337) 1s ok: run: sidekiq: (pid 79348) 0s ok: run: unicorn: (pid 79353) 1s [root@linux-node1 etc]#
重启之后,打开网页,问题解决
http://192.168.58.11/