Note: The native support for including files from other non-public repositories was added in Gitlab 11.7, so this workaround is no longer needed.
Gitlab added new include statement for the CE edition of their product with the 11.4.0 release, which is great news. However there's this one minor thing mentioned in the documentation:
Note: The remote file must be publicly accessible through a simple GET request, as we don't support authentication schemas in the remote URL.
This makes it a little bit tricky to use the functionality if you want to fetch the file from private repository. Here's how I got it working. (TL/DR at the end)