I'm having trouble pushing commits on a hotfix
branch created with git-flow
to the remote repository.
Here is the error:
$ git push origin hotfix/MyHotfix
Counting objects:
... etc
To {my remote repo}
! [remote rejected] hotfix/MyHotfix -> hotfix/MyHotfix (no such ref)
error: failed to push some refs to {my remote repo}
I created the hotfix
with the standard syntax:
git flow hotfix start MyHotfix
and this branch is already present on the origin
, which I can see with git branch -a
.
I have also checked that the branch is still present on the remote server, since it shows up when I run git remote show origin
.
Has anyone come across this before with git
or git-flow
and found a solution?
Note - things I have tried:
git remote prune origin
)Update:
git ls-remote origin
and git show-ref
show different refs for the local and remote hotfix branches, but this is because I have 1 extra commit locally, and the parent commit's ref matches the ref on origin
.
It looks like it was actually a problem with the server repository. Running these steps on the bare repo on the server cleared up the error:
git fsck --full
git prune
git gc
Note: according to the man pages git prune
isn't required because git gc
calls it, but I was trying everything.
Considering issue 92, I don't think hotfix branches are meant to be published.
This is a feature request which is still pending.
While
release
andfeature
branches can all be published (git flow release/feature publish
), hotfix branches cannot.
So maybe the push itself has been prevented to be compliant with the (already denied) publish operation.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With