混帐错误:未能推送一些裁判 [英] git error: failed to push some refs to

查看:56
本文介绍了混帐错误:未能推送一些裁判的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

出于某种原因,我现在不能推动,而我可以在昨天做到。
也许我搞砸了配置或什么。



这是发生了什么:



当我使用git push origin master

p>

我的工作目录和远程资源库看起来像这样:

解决方案

如果GitHub仓库看到新的提交到它,当你在本地工作,我会建议使用:

  git pull --rebase 
git推

完整的语法是:

  git pull --rebase origin master 
git push origin master



通过这种方式,您可以在新更新的 origin / master - rebase 部分)本地提交c $ c>(或 origin / yourBranch git pull origin yourBr $ b

查看第6章使用 Git Pocket Book



我会推荐一个:

  git push -u origin master 

这会在您的本地主分支和它的上游分支。

之后,任何未来推送该分支都可以用一个简单的方法来完成:

  git push 

请参阅为什么我需要显式推送新分支?






由于OP已经 origin / master $ c>:

  g它重置 - 混合起源/主
git add。
git commit -m这是我原本计划修改的新提交
git push origin master

不需要拉--rebase



注意: git reset --mixed origin / master 也可以写成 git reset origin / master ,因为 - 混合选项是使用 git reset


For some reason, I can't push now, whereas I could do it yesterday. Maybe I messed up with configs or something.

This is what happens:

When I use the git push origin master

What my working directory and remote repository looks like:

解决方案

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

git pull --rebase
git push

The full syntax is:

git pull --rebase origin master
git push origin master

That way, you would replay (the --rebase part) your local commits on top of the newly updated origin/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

See "Why do I need to explicitly push a new branch?".


Since the OP already reset and redone its commit on top of origin/master:

git reset --mixed origin/master
git add .
git commit -m "This is a new commit for what I originally planned to be amended"
git push origin master

There is no need to pull --rebase.

Note: git reset --mixed origin/master can also be written git reset origin/master, since the --mixed option is the default one when using git reset.

这篇关于混帐错误:未能推送一些裁判的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆