Why "git push origin master" doesn't work?

alice picture alice · Aug 3, 2014 · Viewed 7.4k times · Source

I follow steps in http://jekyllbootstrap.com/usage/jekyll-quick-start.html to install Jekyll-Bootstrap.

I can run

http://localhost:4000

in local and I have set ssh, but git push origin master doesn't work.

--- This is the error interface ---

$ git push origin master To [email protected]:XXX/XXX.github.com.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to '[email protected]:XXX/XXX.github.com.git' hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Does someone know why git push origin master doesn't work?

Answer

Knut picture Knut · Aug 3, 2014

The error message already tells you everything you need to solve the issue. Before a git push origin master you should do a git pull origin master to ensure you have the latest updates from the server.

If you are getting this message you did work on an older version of the repository instead of the latest one.