It depends, you can have private projects and prevent others from accessing it. If you use the free plan, you will not be able to prevent them from viewing your source or downloading it.
GitHub has these two options
Public projects : anyone can view, fork and download the source code.
Private Projects : Only the users you release will have access to the code.
Private projects are only available in paid plans, which range from $ 7 to $ 21 a month on the date of this response.
You can still get an account with unlimited private repositories while you are a student with GitHub Student Developer Pack .
There are some alternatives in the market, the best known being Atlassian's BitBucket . It has basically the same functions as GitHub, but you can create private projects in the free plan, as long as it does not have more than 5 users.
You also have GitLab that you can have private unlimited projects as well as > has no user limit .
I'm not going to give you much more detail about the tools because it does not suit, as well as this is a question about a question about GitHub.