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

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

我有分支 x。我输入 git push origin x:y

我收到错误消息

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

也许这很重要:当我克隆存储库时,为了提高性能我使用了开关

-b master --single-branch

git 版本 2.6.2.windows.1

gerrit 版本 2.9.4

您的 Gerrit 服务器 Git/Gerrit 是什么版本 运行?

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.

如果您的 Gerrit 服务器不支持来自浅克隆的推送,您可能无法使用

--single-branch

当我决定对该问题进行最终调查时,发现

git fetch --unshallow

解决问题。

(解决意味着允许推送一个分支,而不是推送带有浅克隆的分支)