Back
I'm trying to push my project (all files in a new repository). I follow the steps but when I push with git push -u origin master I get this error:
! [rejected] master -> master (non-fast-forward)error: failed to push some refs to '[email protected]:asantoya/projectnewbies.git'To prevent you from losing history, non-fast-forward updates were rejectedMerge the remote changes (e.g. 'git pull') before pushing again. See the'Note about fast-forwards' section of 'git push --help' for details.
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to '[email protected]:asantoya/projectnewbies.git'
To prevent you from losing history, non-fast-forward updates were rejectedMerge the remote changes (e.g. 'git pull') before pushing again. See the'Note about fast-forwards' section of 'git push --help' for details.
I got this error many times and can't figure out what to do.
According to my understanding, your local branch is out of sync with your tracking branch.
Depending upon your workflow and project rules, you might want to use git pull --rebase.
Or Try this:
git push -f origin master
31k questions
32.8k answers
501 comments
693 users