<分区>
Possible Duplicate:
'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?
我在 git 中获取此信息
>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>'
我一直在用谷歌搜索这个,(例如这里有一个关于它的 stackoverflow 问题 - 'git pull origin mybranch' leaves local mybranch N commits ahead of origin. Why?),一般的建议似乎是先 pull 然后再推。但这对我不起作用 - pull 告诉我我是最新的。我也尝试过“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 服务器上添加一个虚拟文件(它也检查 master),提交它并向上推送,然后在本地将其下 pull 。一切正常。但我还是推不动。谁能告诉我我需要做什么来解决这个问题?我什至不知道说我已经相对于存储库快速转发是什么意思。
干杯,马克斯
编辑 - 对于 ebneter 和 dan(谢谢)
> 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 的新手,所以我不能很好地解释这一点,但我想知道提交是否以 root 身份完成(顶部第 6 行),'merge branch master...' 是否已经竖起事情了。我不记得以 root 身份执行过提交,感到困惑...
Dan - 我认为你是对的:我尝试推送时遇到的错误是
error: unable to create temporary sha1 filename ./objects/05: File exists
fatal: failed to write object
error: unpack failed: unpacker exited with error code
编辑 - 我之前提到的另一个 stackoverflow 问题的评论确实修复了它:
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