Problem
On the GitLab sign-in page there are links to 'Explore' public repositories and also a 'Help' link. Although GitLab will only list public repositories (i.e. repositories you mark as public) - it may be desirable to disable these links for anonymous users.
Workaround
Although we can't disable these links, we can redirect them back to the sign-in page for anonymous users.
To do so, we'll need to modify a file and then run reconfigure on GitLab.
First, let's backup and then edit the configuration file
cd /opt/gitlab/embedded/service/gitlab-rails/app/controllers/ sudo cp application_controller.rb application_controller.rb.orig sudo nano application_controller.rb
We'll need to add the following code snippets to application_controller.rb
... before_action :force_authenticated_user! ... def force_authenticated_user!(*args) if (!current_user) and (["/explore", "/help"].include?(request.path)) redirect_to new_user_session_path and return end end ...
References
Related articles