What are Git and GitHub?
First of all, it should be noted that Git and GitHub are two different things. Closely related, but different.
Git is a version control system. You can commit your project(s) and then carry on making additions, deletions and changes to your project. But then, if needs be, you can refer to, or even revert to, previous versions. All of the information is stored on your computer. No longer do you need to create loads of directories names version001, version002 etc.; Git takes care of all that for you behind the scenes.
GitHub, on the other hand, is a web-based Git repository hosting service. Once you have set up your GitHub account, you can push your project(s) to GitHub. For even a single-person project, this can be immensely useful; not only are you creating an off-site backup every time you push your project, but you can also easily copy your project from one computer to another. GitHub becomes even more useful when you are collaborating on a project with others. GitHub allows you to control access to your projects as well; you can specify that a project is to be private, can be shared with your team, or can be accessed by all.
Please note that a "project" in the context of Git and GitHub need not necessarily be a software project. You can use it for more or less any type of endeavour that is stored in a directory tree. For example, I am helping with the design of the cover of a friend's forthcoming novel. This is a very iterative process, and several times have I been asked to backtrack; thank goodness I was committing each version to Git! It has saved a lot of time, I can tell you!
Starting Out with Git
Installation of Git is remarkably straightforward; I'll simply refer you to the Getting Started - Installing Git page on the Git website for that.
Once Git is installed, the first thing to do is to initialise a repository. So, on the command line, navigate to the root directory of your project and issue the following command.
git init
Next you can enter
git status
to show you a list of the items in your project that have been added, changed, or deleted since the last commit. And as we haven't committed anything yet, this should be pretty much all of the files and sub-directories.
Assuming that we want all of the listed items to be included in our next (first) commit, we should not enter the command...
git add .
This step is referred to as "staging" in the documentation.
If we run the "git status" command again, you will see that it tells us that the items are staged.
All that remains to be done now is to perform the actual commit. like so...
git commit -m "First commit"
The "First commit" in the example above is simply a string of text describing the changes made. It's a good idea to do a commit every time you complete a task and your desciptive text should reflect what it is that you have done.
So now you are able make versioned backups of your projects. For details of how to restore projects and many advanced features, please refer to the Git documentation.
Starting Out with GitHub
To use GitHub, you will need to register for an account. I would recommend starting out with a free account. Until not so long ago, GitHub limited free users to just one private repository, but that restriction has since been lifted and even free users can have unlimited private repositories.
Now that you are registered, you'll need to create a registry on GitHub. This is easiest done by means of their website, rather than from your computer's command line. Once you have set up the repository, you will be given the URL of your repository; it will be something along the lines of "https://github.com/YOUR-USERNAME/YOUR-REPOSITORY.git".
Moving back to the project directory on your computer, execute the following command in the terminal...
git remote add origin "<repository URL>"
You'll need to substitute the repository URL between the speech marks, of course.
Now we have specified the path to the remote repository, we can push the most recently committed version of the project up to GitHub with the command...
git push origin master
I would suggest pushing your project after each and every commit. That way you will always have a recent off-site backup of your project.
You can examine the repository that you have just uploaded on the GitHub website.
Final Thoughts
Hopefully this article has given you enough to start creating repositories, staging items and making commits. But this is way less than half the story. I would thoroughly recommend reading your way through the GitHub Guides to increase your understanding and knowlwedge of both Git and GitHub.
One final thought on security; although your private repositories are, well, private, you should consider not storing private or personal information, such as your address or passwords, along with your projects on GitHub.