I give up! Whenever I try to push I get a stupid:
! [rejected] master -> master (non-fast forward)
error: failed to push some refs to \'git@github
Actually I got the same error but the below comment worked for me
git push -f origin master
If push request is shows Rejected, then try first pull from your github account and then try push.
Ex:
In my case it was giving an error-
! [rejected] master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ashif8984/git-github.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
****So what I did was-****
$ git pull
$ git push
And the code was pushed successfully into my Github Account.