问题
Is there a way to password protect a website published using GitLab 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.
回答1:
See this answer to a very similar question. (Full disclosure, it was my question and answer).
This gitlab repo shows a working example here.
Uses static password protection and is also discussed in this issue.
回答2:
GitLab now supports access control for pages in case of self managed GitLab instances:
https://docs.gitlab.com/ce/administration/pages/#access-control
Pages access control is currently disabled by default. To enable it, you must:
Enable it in /etc/gitlab/gitlab.rb
gitlab_pages['access_control'] = true
Reconfigure GitLab
来源:https://stackoverflow.com/questions/41106344/password-protect-gitlab-pages-with-htpasswd