完全卡在git中 - “git push”不起作用,并且“git pull”不'修复 [英] Totally stuck in git - "git push" does not work, and "git pull" doesnt' fix

查看:112
本文介绍了完全卡在git中 - “git push”不起作用,并且“git pull”不'修复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我决定今天试着去搞乱Git,并试着去了解它的分支系统是如何工作的。馊主意。我不知何故已经把自己置于一个我已经在分支上做出改变的状态,当我做git push的时候,我得到了:

I decided to try to mess around with Git today and try to learn how its branching system works. Bad idea. I somehow have gotten myself in a state where I have committed a change on a branch, and when I do "git push" I get:

To git@github.com:LAW/Repo.git
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'git@github.com:LAW/Repo.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again.  See the
'Note about fast-forwards' section of 'git push --help' for details.

我已经看过几次了,我已经完成了git pull我不确定为什么或如何解决事情。问题是,它现在不工作。我做git pull并得到:

I've seen this a few times, and I have done "git pull" to resolve, though I'm not sure why or how that resolves things. The problem is, it isn't working now. I do "git pull" and get:

"Already up-to-date."

问题仍然存在。所以我的问题是......现在是什么?我不能推动分支,所以它基本上是死的,但互联网没有比git pull更好的建议来解决这个问题。不用说这是非常令人沮丧的!

And the problem persists. So my question is...now what? I can't push from the branch, so it is essentially dead, but the internet has no better advice than "git pull" to fix this. Needless to say this is VERY frustrating!

编辑一位评论者请求输出git branch -a。问题分支是PersonalSite

EDIT A commenter requested the output of "git branch -a". The branch in question is "PersonalSite"

* PersonalSite
master
remotes/origin/HEAD -> origin/master
remotes/origin/PersonalSite
remotes/origin/master


推荐答案

您应该可以简单地更新master分支:

You should be able to simply update the master branch:

git checkout master
git pull

验证:

To verify:

git checkout PersonalSite
git push # Should say "Everything up-to-date"

这篇关于完全卡在git中 - “git push”不起作用,并且“git pull”不'修复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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