Here is how to use Gitlab Pages while keeping the content of your Git repository private.

Step 1. From your project page, open SettingsGeneral

Step 2. Click on VisibilityExpand

Step 3. Set Project visibility to Private

Step 4. On the same page, set Pages visibility to Everyone

Done!