Git - “您的分支在3次提交之前超过'origin / master'。” [英] Git - "Your branch is ahead of 'origin/master' by 3 commits."

查看:157
本文介绍了Git - “您的分支在3次提交之前超过'origin / master'。”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能存在重复:

'git pull origin mybranch'离开本地mybranch N提前提交。为什么?


我在git中获取此信息

 > git status 
#在分支master上
#你的分支在3次提交之前领先于'origin / master'。
$
没有提交(工作目录干净)

而且,当我尝试推送,我得到这个:

 致命:未能写入对象
错误:解压缩失败:解压缩已退出错误代码
到ssh:< my repository>
! [remote rejected] master - > master(n / a(unpacker error))
错误:无法将某些引用推送到'ssh:< my repository>'

我一直在使用Google这一点,(例如,有关于它的一个stackoverflow问题 -

 > git remote show origin 
* remote origin
URL:ssh://< my repository>
HEAD分支:master
远程分支:
跟踪的主数
为'git pull'配置的本地分支:
主人与远程主人合并
配置的本地参考对于'git push':
master推送给master(快速转发)

帮助任何人。

我也尝试在我们的Web服务器上添加一个虚拟文件(它也检查主服务器),提交并推送它,然后在本地将其拉下。这一切运行良好。但我仍然无法推动。任何人都可以告诉我我需要做什么来解决这个问题吗?我甚至都不知道这是什么意思,说我已经快速转发到存储库。



干杯,最大值



编辑 - 用于ebneter和dan(谢谢)

 > git config -l 
user.name = Max Williams
push.default =跟踪
core.repositoryformatversion = 0
core.filemode = true
core.bare = false
core.logallrefupdates = true
remote.origin.fetch = + refs / heads / *:refs / remotes / origin / *
remote.origin.url = ssh://< my repo url>
branch.master.remote = origin
branch.master.merge = refs / heads / master

gitk的屏幕截图位于 http://dl.dropbox。 com / u / 846812 / gitk.png




  • 我是git的新手,所以我无法很好地理解这一点,但我想知道如果提交作为根(在顶部的第6行),'合并分支大师......'也许竖起了事情。我不记得以root身份进行提交,感到困惑...



Dan - 我认为你是对的:获取当我尝试推送

 错误:无法创建临时sha1文件名./objects/05:文件存在

致命错误:未能写入对象
错误:解包失败:解包用错误码退出

编辑 - 这个来自我之前提到的其他stackoverflow问题的注释确实修正了它:


git remote alone(显示GitHub仓库的正确地址)不足
。为避免在
git pull之后出现您的分支在前警告消息,您还需要首先为分支定义远程名称。
因此我的建议是:输入git config branch.master.remote
yourGitHubRepo.git,然后尝试一个git pull和一个git状态,看看
是否仍然存在。 - VonC 11月16日20:22



解决方案

看起来你遇到的问题是与远程拒绝行中提到的解包错误有关。出于某种原因,远程端未能解开发送给它的对象。这可能是由许多因素造成的。有些东西你可以尝试:

  git fsck --full 

在本地和远程运行(如果可能的话)。

  git repack remotes / origin / master 

在本地仓库运行。



如果这两项都不能解决问题,请尝试使用Google搜索 gitunpacker error 。我个人从来没有遇到过这个问题,所以不幸的是我可以给出的所有建议。


Possible Duplicate:
'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?

I'm getting this info in git

>git status
# On branch master
# Your branch is ahead of 'origin/master' by 3 commits.
#
nothing to commit (working directory clean)

And, when i try to push, i get this:

fatal: failed to write object
error: unpack failed: unpacker exited with error code
To ssh:<my repository>
 ! [remote rejected] master -> master (n/a (unpacker error))
error: failed to push some refs to 'ssh:<my repository>'

I've been googling this a bit, (eg there's a stackoverflow question about it here - 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why? ) and the general advice seems to be to do a pull then a push. But this doesn't work for me - a pull tells me i'm up to date. I've also tried 'git fetch origin' (nothing). I've also tried:

> git remote show origin
* remote origin
  URL: ssh://<my repository>
  HEAD branch: master
  Remote branch:
    master tracked
  Local branch configured for 'git pull':
    master merges with remote master
  Local ref configured for 'git push':
    master pushes to master (fast forwardable)

In case that helps anyone.

I also tried adding a dummy file on our web server (which also checks out master), committing it and pushing it up, then pulling it down locally. That all worked fine. But i still can't push. Can anyone tell me what i need to do to resolve this? I don't even really know what it means to say that i've fast forwarded relative to the repository.

cheers, max

EDIT - for ebneter and dan (thanks)

> git config -l
user.name=Max Williams
push.default=tracking
core.repositoryformatversion=0
core.filemode=true
core.bare=false
core.logallrefupdates=true
remote.origin.fetch=+refs/heads/*:refs/remotes/origin/*
remote.origin.url=ssh://<my repo url>
branch.master.remote=origin
branch.master.merge=refs/heads/master

A screen grab of gitk is at http://dl.dropbox.com/u/846812/gitk.png

  • i'm new to git so i can't interpret this very well, but i'm wondering if the commit done as root (line 6 in the top section), 'merge branch master...' has maybe cocked things up. I don't remember doing a commit as root, puzzled...

Dan - I think you're right: the error i get when i try to push is

error: unable to create temporary sha1 filename ./objects/05: File exists

fatal: failed to write object
error: unpack failed: unpacker exited with error code

EDIT - this comment from the other stackoverflow question i referred to earlier did actually fix it:

git remote alone (showing the right address for GitHub repo) is not enough. To avoid having an "Your branch is ahead" warning message after a git pull, you need first to also define the remote name for a branch. Hence my suggestion: type git config branch.master.remote yourGitHubRepo.git, then try a git pull and a git status and see if the issue remains. – VonC Nov 16 at 20:22

解决方案

It looks like the problem you are having is related to the "unpacker error" mentioned on the "remote rejected" line. For some reason the remote end is failing to unpack the objects that were sent to it. This could be caused by any number of things. Some things you can try:

git fsck --full

Run that locally and at the remote (if possible).

git repack remotes/origin/master

Run that on the local repo.

If neither of those fixes the problem, try googling git "unpacker error" for other ideas. I've personally never experienced this problem, so that's unfortunately about all the advice I can give.

这篇关于Git - “您的分支在3次提交之前超过'origin / master'。”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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