There is no harm in having public repositories. However it is true that recruiters like to browse your GitHub profile and see what you have done. If you have a mix of 'beautiful' and 'ugly' projects, you can always make a portfolio website that displays the beautiful projects, or even explains which repositories are beautiful and which are sandboxes. Also it is a good practice to describe each repository in a README.md
document on the root of the repository, that way, visitors to the repository can understand the purpose and spirit of the project without having to rely on making their own judgment.
It is always possible to use BitBucket or private GitHub repositories to host your private or test projects. However, the two methods of using a portfolio and writing READMEs are usually sufficient.
To create a unifying experience, please consider publishing a portfolio website at username.github.io
. This is possible through GitHub Pages.
Although your code may be terrible, it is important to consider that great projects start off terribly, code changes over time, and publishing terrible code has the advantage of showing that you are actively working on projects. But of course it is also recommended to use the usual guidelines of coding such as making sure every commit is a working commit, using testing code etc.