Search code examples
gitgerritgit-push

On git push I got error: error: invalid protocol: wanted 'old new ref'


I have branch x. I type git push origin x:y

I got error message

error: error: invalid protocol: wanted 'old new ref'
fatal: internal server error
fatal: The remote end hung up unexpectedly
Counting objects: 140, done.

Maybe it is imporant: when I cloned repository, for performance I used switches

-b master --single-branch

git version 2.6.2.windows.1

gerrit version 2.9.4


Solution

  • What version of Git/Gerrit is your Gerrit server running?

    https://phabricator.wikimedia.org/T86304

    it's related to shallow clones; git 1.7 can push from shallow clones in some cases (including a fresh clone, which is what g-p-u does), and git 1.9 can always push from shallow clones if the server supports it.

    If your Gerrit server does not support pushes from shallow clones you may not be able to use

    --single-branch