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
gitk --all
to get a visual on where your commits are. – Vanegit config branch.master.remote my_git_repo
and it cleaned it all up. – Jankowski