When a WordPress developer creates a plugin or a theme, he can share it using a WordPress repository. But it is important to release the work under a General Public License (GPL). With a GPL in place, the users get certain rights to your work when they download and use it. In general, the GPL allows you to retain appropriate copyrights to your work. So, each of the files in your works must have this license.
For more detail click here: https://www.cyblance.com/wordpress/skills-that-make-the-best-wordpress-developers/