2010-02-26 64 views
13

可能重复:
'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?Git - “你的分支在3次提交之前领先于'origin/master'。”

我得到这个信息的混帐

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

,当我试图推动,我得到这个:

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>' 

我一直在使用Google这一点,(例如,这里有一个关于它的stackoverflow问题 - 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?),一般建议似乎是做一个拉,然后推。但是这对我不起作用 - 拉我告诉我我是最新的。我也试过'git fetch origin'(没有)。我也试过:

> 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) 

如果有帮助的人。

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

欢呼,最大

编辑 - 为ebneter和丹(感谢)

> 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 

gitk的屏幕抓取是http://dl.dropbox.com/u/846812/gitk.png

  • 我是新来的git这样我就可以这不是很好解释,但我想知道是否作为根(在顶部的第6行),'合并分支大师......'做的提交可能已经把事情搞砸了。我不记得做了承诺为根本,困惑......

丹 - 我认为你是对的:我得到当我试图把误差

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

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

编辑 - 这从另一个计算器问题,我前面提到的实际上确实解决这个问题发表评论:

远程Git单独(出正确的地址为GitHub库)是不是 不够。为了避免在 git pull之后出现“您的分支在前”警告消息,您还需要首先为分支定义远程名称。 因此,我的建议:输入git config branch.master.remote yourGitHubRepo.git,然后尝试git pull和git status,看看 问题是否仍然存在。 - VonC 11月16日20:22

+2

尝试运行'gitk --all'来获取您的提交内容的视觉。 – noah 2010-02-26 15:26:30

+0

您收到的错误通常表明遥控器上出现了问题。但是,您似乎暗示您可以从您的Web服务器推送。是对的吗?你可以显示你的配置文件的全部内容(git config -l)吗? – ebneter 2010-02-26 23:38:23

+0

有一个答案提供[这里](http://stackoverflow.com/questions/1741143/git-git-pull-origin-mybranch-leaves-local-mybranch-n-commits-ahead-of-origin) – Surya 2010-02-27 01:44:08

回答

8

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

git fsck --full 

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

git repack remotes/origin/master 

在本地仓库运行。

如果这些问题都没有解决问题,请尝试使用其他方法搜索git "unpacker error"。我个人从未遇到过这个问题,所以不幸的是我可以提供的所有建议。

相关问题