search

Home  >  Q&A  >  body text

github - git push error

I have set up SSH on gitHub before and pushed it successfully once, but I got an error when I pushed it today

$ git push origin master
To git@github.com:ZhuYutao/learngit.git
 ! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'git@github.com:ZhuYutao/learngit.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.
迷茫迷茫2796 days ago597

reply all(3)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:31:44

    There is a reason in the error message.
    Before you pushed this time, someone else pushed to the server. Your local is not up to date.
    You need to git pull first and then push.

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-02 09:31:44

    Upstairs is a solution, you can also force submission

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:31:44

    It is a habit to git pull and then git push every time you commit, otherwise the above situation will occur

    reply
    0
  • Cancelreply