git 协议错误:预期的旧/新/参考,得到“浅层深...”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21557004/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 09:41:36  来源:igfitidea点击:

protocol error: expected old/new/ref, got 'shallow deeb...'

git

提问by Ionic? Biz?u

I am editing a git repository that was cloned using --depth 1(shallow clone).

我正在编辑一个使用--depth 1(浅克隆)克隆的 git 存储库。

I want to push my changes (commits) but I get this error:

我想推送我的更改(提交),但出现此错误:

$ git push
Counting objects: 14, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 56.88 KiB | 0 bytes/s, done.
Total 8 (delta 5), reused 0 (delta 0)
fatal: protocol error: expected old/new/ref, got 'shallow deeb2171db739fd366...'
fatal: The remote end hung up unexpectedly
fatal: The remote end hung up unexpectedly

How can I solve this?

我该如何解决这个问题?

Running git --versionI get this:

运行git --version我得到这个:

$ git --version
git version 1.9.rc1

回答by Gabriel Petrovay

git fetch --unshallow

Also see: how to unshallow your repo

另请参阅:如何取消您的回购