How to minimize cheating with open source assignments? For my computer science programming-based course, I'd like to:

1) host my course and assignments (without solutions) open and free to all (e.g., as public GitHub repos)

but this seems at odds with also wanting to

2) not have to deal with rampant cheating.

Any open source assignments seem to suffer from the problem that a random stranger could do the assignment in her spare time and then post the solution online. So in theory, publicly hosting the assignments has created an avenue for my students to find a free solution.

Hosting my assignments on GitHub lubricates this process because the programming community knows how to click "fork" and any forks are listed right there for future students to browse.

What are recommendations or best practices to find the right balance?

The extremes have clear tradeoffs:

A) go full public. this is easy for me to implement using GitHub, but even students in our classes will have easy access to other students in the same section. I can run/threaten to run MOSS, but students may still try to beat it and that will create a hassle.

versus

B) go full private. I lose all the niceties of the GitHub interfaces, lose my open source freely available and advertised assignments to the larger community and world.
As somebody who has, for years, hosted assignments publicly I feel that you are vastly overestimating the threat case here. If all you do is make your assignment and material public on GitHub, it is extremely unlikely that somebody will just browse by, do it out of fun, and then make the solution available to your students.

I often analyse GitHub data as part of my research, and the number of repositories out there is downright staggering, and by far most of them get no traction at all. In order to make a repository visible, quite a bit of active marketing is necessary. If you don't go out of your way to advertise your assignment, and if your assignment is not somehow extremely intriguing so that a random developer would really want to work on it, it is very likely to just sit there, all in the public, without getting any kind of attention at all.

Additionally, even if somebody would solve your assignment and make a solution public, so what? You presumably do some sort of plagiarism check on the solutions your students submit anyway (otherwise, how do you ensure that different students or teams did not copy from each other?) - this is just one more existing solution to compare your student's solution to.

In my experience, by far the most "rampant" type of cheating is student teams copying from each other, and this is really unaffected by how you decided to host your assignment.