Asantoya17 Asantoya17 - 1 year ago 387
Git Question

rejected master -> master (non-fast-forward)

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 ''
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.

really many times I got this error and can't figure out what to do.

pmr pmr
Answer Source

As the error message says: git pull before you try to git push. Apparently your local branch is out of sync with your tracking branch.

Depending on project rules and your workflow you might also want to use git pull --rebase.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download