Here is how to use Gitlab Pages while keeping the content of your Git repository private.
Step 1. From your project page, open Settings
→ General
Step 2. Click on Visibility
→ Expand
Step 3. Set Project visibility
to Private
Step 4. On the same page, set Pages
visibility to Everyone
Done!