I had some trouble with getting this to work as I already had a github account and 2-factor auth already set up.
I went back and re-read the question and there is a link provided which gives details on how to solve this issue. You will need to pay attention to the 'How does it work for command-line Git?' section and it will advise that you make a personal access token. Once this is complete you just need to use your github username and the personal access token you just made instead of your password.
I hope this saves the next person who is stuck some time!