github中git push origin master出错:error: failed to push some refs to

来源:互联网 发布:应急数据采集更新制度 编辑:程序博客网 时间:2024/06/05 10:18
94 down vote accepted 

If the GitHub repo has seen new commits pushed to it, while you were working locally, I would advice for:

git pull --rebasegit push

The full syntax is:

git pull --rebase origin mastergit push origin master

That way, you would replay (the --rebase part) your local commits on top of the newly updatedorigin/master (or origin/yourBranch: git pull origin yourBranch).

See a more complete example in the chapter 6 Pull with rebase of the Git Pocket Book.

I would recommend a:

git push -u origin master

That would establish a tracking relationship between your local master branch and its upstream branch.
After that, any future push for that branch can be done with a simple:

git push
0 0
原创粉丝点击