2
$ git log
 commit 49a37bc9fd27c909e4fe77812041fd38b9755f61 (HEAD -> master)
 Author: chenghuang <574637816@qq.com>
 Date:   Thu Dec 7 14:15:42 2017 +0900

useless

commit e9b08e2b428f9dd58aa0b792ebeb29da4270dfab
Author: chenghuang <574637816@qq.com>
Date:   Tue Dec 5 22:45:31 2017 +0900

20171205_Checklist_well

I just have to commits in my git log.

$ git branch #my current branch is master
 * master

$ git remote -v #This is my remote github url
origin  https://github.com/ekoopgj/Shell_learning.git (fetch)
origin  https://github.com/ekoopgj/Shell_learning.git (push)    

$ git push -u origin master
Username for 'https://github.com':
Password for 'https://ekoopgj@github.com':
To https://github.com/ekoopgj/Shell_learning.git
! [rejected]        master -> master (fetch first)
error: failed to push some refs to 'https://github.com/ekoopgj/Shell_learning.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.

I can't push my updates to remote . What's it mean that "remote work contains that you do"?

BlindSniper
  • 1,731
  • 3
  • 16
  • 30
huang cheng
  • 393
  • 3
  • 15

2 Answers2

2

The full sentence is

the remote contains work that you do not have locally.

That means someone has pushed on the remote master before you.

A git pull (or better: git pull --rebase) will allow you to get those modification, and to push yours back.

VonC
  • 1,262,500
  • 529
  • 4,410
  • 5,250
1

This means that your copy of source code is not latest and causing mismatch. Take latest from master, may be in other location merge your changes with it and then try to push again

BlindSniper
  • 1,731
  • 3
  • 16
  • 30