Confused with git-push
I faced to a situation that puzzles me but I guess the answer is very simple, it is just I can't see it... Hopefully someone can help me
I have a git repo. git-status says that I have 4 commits queued:
]$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 4 commits.
#
nothing to commit (working directory clean)
So I do git-push (git push origin
) and then it looks fine, i.e. then I have nothing to push. But when I pull (or fetch + merge) the repo in another directory, the changes don't show up.
Moreover, I can pull from the remote into the local directory (git pull origin
) which results with:
+ a4ac30f...10164ca master -> origin/master (forced update)
Already up-to-date.
and after that I am again 4 commits ahead, i.e. in the same situation I've started. So I can repeat the two commands:
git push origin
which always results in:
]$ git push origin -v
Pushing to http://myserver.com/src.git/myrepo
Fetching remote heads...
refs/
refs/heads/
refs/tags/
Everything up-to-date
and
git pull origin
whose result is always as quoted above infinite number of times and nothing happens, after the first one I am always "Everything up-to-date
" and after the second one I am always "开发者_Python百科ahead of 'origin/master' by 4 commits
"
In both local repositories Fetch URL and Push URL are the same; git remote show origin
says:
HEAD branch: master
Remote branches:
git-svn tracked
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)
Best, Tim
OK, I solved it! The problem was that some previous push
didn't go correctly and the remote was screwed up. I logged into the remote server (which is WebDAV-based) and run chown -R wwwrun src.git
. Then the very next push did the job
It sounds like your master branch is not set up to track origin/master, and therefore git push
is ignoring it entirely. Try git push origin master
to tell it specifically which branch to push.
精彩评论