It doesn't have to be a real-world open source project.
Could be a project you built to learn a language or framework, for example.
Or some library you wrote for your own personal use. If there's nothing sensitive, you can publish it under an open license or even without any license at all...
Some employment contracts claim ownership of anything you create even outside of working hours, so even publishing those little learning projects could potentially be problematic.
For this purpose, you only need to show authorship, which is different from ownership rights.
In general, your employer can't stop you there. Some exceptions would be if it conflicts with their products or if you disclose technological knowledge that could jeopardize competitive advantage.
Some exceptions would be if it conflicts with their products
Amazon has that provision in its employment contract. The problem is that Amazon has its fingers in so many pies, no matter what you write, you could potentially get in trouble with legal. One person I knew there had to wait six weeks for approval from legal so they could work on a Lisp interpreter.
Even if they're not likely to win in a court battle, most people don't want to risk a dispute over something trivial.
Would you expect a little game jam game created in a weekend to lead to an ownership dispute with an employer? - Probably not, but I'm aware of a case where it has happened...
Why would you publish code that was written during working hours?
Why not publish an university project, a learning exercise, or something you built for fun? Surely there is more reason to create something than you're getting paid to do it, right? Or are artists just silly?
I think some of my university projects are published. But they're quite old by now, and not representative of the production code I write. I do learning exercises quite frequently when getting into new libraries/frameworks/languages, but again, that's on company time.
I don't begrudge others that do, but I don't code in my free time, I have other hobbies. Thus getting back to the original point made:
> Because every skilled person has time to build stuff in public.
Could be a project you built to learn a language or framework, for example.
Or some library you wrote for your own personal use. If there's nothing sensitive, you can publish it under an open license or even without any license at all...