Gitlab页面底部添加ICP备案号

前几天托管gitlab的服务器收到了ISP公司的电话提醒,说需要在页面底部增加备案号并指向miit。

由于gitlab是用ruby语言编写的可能很多人看不懂复杂的目录结构,其实gitlab也属于mvc结构的项目

如果您不懂ruby或者gitlab的项目结构,可以直接按以下步骤修改公共view视图的footer文件并重启服务器

(只针对新版的gitlab目录结构,旧版的请搜索devise_empty.html.haml文件):

本次修改的版本为:Gitlab v16.0.1-ee

如果版本不是这个版本,格式可能不是下面的格式,请参考下面的方式进行修改,并在修改前备份好相关文件,以免出现程序故障。

第一步:添加备案号:

文件默认路径:/opt/gitlab/embedded/service/gitlab-rails/app/views/devise/shared/_footer.html.haml

原始文件内容如下:

%hr.footer-fixed
.container.footer-container.gl-display-flex.gl-justify-content-space-between
  .footer-links
    - unless public_visibility_restricted?
      = link_to _("Explore"), explore_root_path
      = link_to _("Help"), help_path
    = link_to _("About GitLab"), "https://#{ApplicationHelper.promo_host}"
    = link_to _("Community forum"), ApplicationHelper.community_forum, target: '_blank', class: 'text-nowrap', rel: 'noopener noreferrer'
  = render 'devise/shared/language_switcher'
= footer_message

添加你的备案号到你想要的位置,我这里添加为第一个:

%hr.footer-fixed
.container.footer-container.gl-display-flex.gl-justify-content-space-between
  .footer-links
    -# 下面这一行
    = link_to _("蜀ICP备12011864号"), "http://beian.miit.gov.cn/"
    - unless public_visibility_restricted?
      = link_to _("Explore"), explore_root_path
      = link_to _("Help"), help_path
    = link_to _("About GitLab"), "https://#{ApplicationHelper.promo_host}"
    = link_to _("Community forum"), ApplicationHelper.community_forum, target: '_blank', class: 'text-nowrap', rel: 'noopener noreferrer'
  = render 'devise/shared/language_switcher'
= footer_message

第二步:重启gitlab服务,等待1-2分钟再查看即可生效

评论

  1. Macintosh Chrome 114.0.0.0
    10 月前
    2023-6-19 7:27:52

    国内备案后,各种要求整改,哎

    • 博主
      王光卫博客
      Android Chrome 114.0.0.0
      10 月前
      2023-6-19 8:40:14

      其实内部使用的话还好,私密库就好,我们公开的库是mirror到gitea上的,其他都是不公开的

    • 博主
      王光卫博客
      Windows Edge 109.0.1518.115
      10 月前
      2023-6-21 15:21:59

      只是这个gitlab还是公开在公网上,方便各位同事远程办公拉取仓库,能被检索到所以才要求挂备案号

发送评论 编辑评论


				
上一篇
下一篇