Hide files in repository

I would like to hide a file in one of my repositories on Gitlab.

This is the situation:
I share the link to my repository with students in my class. So students can pick an assignment from my repo.
However, I also want to include a file, with the right answers. This is for my convenience.
I would like to hide that file. So students are not able to view the contents.

I tried:
gitignore;
The use of .gitignore is not a solution, because the answer file will not be included in the repo. And it should be there.

private
I have tried to make the answer file private, but that seems not the way to go.

Mark as hidden file
Hidden files, in Linux with a preceding dot, will appear as .file

Is it in one way or another possible?

This is not possible by design. Secrets are intentionally separate from version control etc.

Maybe make a private repository just for answers?

And if you have committed the solutions, then removed them, then if students can see the history, they could just check out a commit with the solutions still in. So, if this is the case, make sure you delete any history with the solutions in it.

I like that you’re getting students familiar with GitLab, I would have appreciated that when I was at school/uni.

Anyway this is replying to an old af topic, what did you end up doing?

Thanks for coming back to my question!
I ended up creating a separate branch for the answer files. But I realize, if I continue teaching Git and Gitlab to my students, this will also be far from a perfect solution.