gitlab頁腳添加備案號

01 gitlab頁腳添加備案號

gitlab是用ruby開發的,也採用mvc的方式,所以在安裝的主目錄中/opt/gitlab/embedded/service/gitlab-rails/app/下面會看到 models, views, controllers目錄。猜測頁腳內容可能在 views 下面。

在搜索 /opt/gitlab/embedded/service/gitlab-rails/app/views$目錄下搜索:
grep -rn "https://about.gitlab.com/" ./
會查到如下內容對應的文件。

link_to _("About GitLab"), "https://about.gitlab.com/"

gitlab的sign_in頁面的頁腳內容在/opt/gitlab/embedded/service/gitlab-rails/app/views/layouts/下的devise*.haml兩個ruby文件中。

devise.html.haml
devise_empty.html.haml

sudo vim devise_empty.html.haml

    .container
      .footer-links
        = link_to _("Explore"), explore_root_path
        = link_to _("Help"), help_path
        = link_to _("About GitLab"), "https://about.gitlab.com/"
    = footer_message

改爲:

    .container
      .footer-links
        = link_to _("Explore"), explore_root_path
        = link_to _("Help"), help_path
        = link_to _("滬ICP備19006551號"), "http://beian.miit.gov.cn/"
    = footer_message

02 配置中文

/profile 頁面下可以設置語言

03 修改管理員密碼

設置gitlab的超級管理員密碼爲12345678

sudo gitlab-rails console production
user = User.where(id:1).first
user.password = '12345678'
user.password_confirmation = '12345678'
user.save!
quit
sudo gitlab-ctl restart
ubuntu@VM-14-230-ubuntu:~$ sudo gitlab-rails console production
-------------------------------------------------------------------------------------
 GitLab:       11.6.0-ee (4c09765)
 GitLab Shell: 8.4.3
 postgresql:   9.6.11
-------------------------------------------------------------------------------------
Loading production environment (Rails 5.0.7)
irb(main):001:0> user = User.where(id:1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = '12345678'
=> "12345678"
irb(main):003:0> user.password_confirmation = '12345678'
=> "12345678"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: 7ac4e02f-c97b-43ed-be8b-ff33c2ae53e9) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007fd565229f60 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):005:0> quit
ubuntu@VM-14-230-ubuntu:~$ sudo gitlab-ctl restart
ok: run: alertmanager: (pid 10618) 0s
ok: run: gitaly: (pid 10637) 1s
ok: run: gitlab-monitor: (pid 10650) 0s
ok: run: gitlab-workhorse: (pid 10667) 1s
ok: run: logrotate: (pid 10691) 0s
ok: run: nginx: (pid 10720) 1s
ok: run: node-exporter: (pid 10726) 0s
ok: run: postgres-exporter: (pid 10770) 0s
ok: run: postgresql: (pid 10819) 1s
ok: run: prometheus: (pid 10828) 0s
ok: run: redis: (pid 10839) 1s
ok: run: redis-exporter: (pid 10845) 0s
ok: run: sidekiq: (pid 10857) 0s
ok: run: unicorn: (pid 10869) 0s
ubuntu@VM-14-230-ubuntu:~$ 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章