使用htpasswd密码保护GitLab页面 [英] Password protect GitLab pages with htpasswd
问题描述
是否可以通过密码保护使用 GitLab页面发布的网站 ?
Is there a way to password protect a website published using GitLab pages?
我尝试将.htpasswd
文件添加到/pages
目录的根目录,但这只是使该文件可供访问
I tried adding an .htpasswd
file to the root of the /pages
directory, but that just makes the file available to everyone who goes to https://username.gitlab.io/mysite/.htpasswd.
推荐答案
在自托管GitLab实例的情况下,GitLab现在支持页面访问控制:
GitLab now supports access control for pages in case of self managed GitLab instances:
https://docs.gitlab.com/ce/administration/页面/#access-control
当前默认情况下禁用页面访问控制.要启用它,您必须:
Pages access control is currently disabled by default. To enable it, you must:
-
在/etc/gitlab/gitlab.rb
Enable it in /etc/gitlab/gitlab.rb
gitlab_pages['access_control'] = true
Reconfigure GitLab
这篇关于使用htpasswd密码保护GitLab页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!