For this tutorial I will be assuming you have already setup a site on Github Pages that's being run on the standard USERNAME.github.io domain. If you haven't done so, a quick Google search will yield lots of articles explaining the process. I'm using Bluehost as my domain provider, but the steps should be similar for any major domain provider.
In your Github repo for the site, navigate to the "Settings" tab. Scroll down and you will find an area for Github Pages setup. In the Custom Domain section, enter the domain name you want to use and click save.
If you're using a static site generator, you may already have a file in your repo called CNAME. If you don't, you can create one. Inside this file, place the domain name.
Now open the domain provider that you are using, and navigate to the DNS section for the domain you are interested in using.
First you will need to add four A host records. The host record for each of these is "@". The image below shows what it looks like on Bluehost.
The four IP addresses (at the time of writing this) for each record to be added are:
That's it! The records will probably take some time to update, so be patient. After they update you should see your site live on the domain you've provided.