git无法将我的更新推送到远程

时间:2017-12-07 05:24:46

标签: git github

$ 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

我只需要在我的git日志中提交。

$ 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.

我无法将更新推送到远程。 “远程工作包含你做什么”是什么意思?

2 个答案:

答案 0 :(得分:2)

完整的句子是

the remote contains work that you do not have locally.

这意味着有人在您之前推动了远程主人。

git pull(或better: git pull --rebase)将允许您进行修改,并推动您的修改。

答案 1 :(得分:1)

这意味着您的源代码副本不是最新的并导致不匹配。从master获取最新信息,可能在其他位置合并您的更改,然后尝试再次推送