All code is protected by copyright in one form or the other (unless it has been placed explicitly in the public domain). If you do not attach an explicit copyright license, the default copyright license applies, which amounts to "the code belongs to the author and nobody else can use it."
If you publish your code, especially if it is on a code sharing site like GitHub, you should decide on the license you want to use before committing the very first revision.
Some things to remember:
- If you don't have a license that allows making copies, forking your repository is a violation of your copyright.
- Once you have uploaded a revision of a file with a particular copyright license, you can't change that license. You can upload a new version with a different copyright license (either more or less restrictive), but people will only ever be bound by the license that was in effect at the time that they copied/forked your repository.