If the github repo is pushed with new changes and your local repo doesn't have that changes this error occurs for this you could use:
git pull -rebase
The full syntax is:
git pull --rebase origin master
git push origin master
For pushing, I would recommend you to use -u option:
git push -u origin master
That would establish a tracking relationship between your local master branch and its upstream branch.
For more educational resources on Github, you can visit Github Tutorial.