git fetch --unshallow命令报错:"fatal: --unshallow在完整仓库上没有意义"

25

我无法使用普通方法git clone远程代码库。

git clone path 

我遇到了错误"The remote end hung up unexpectedly"

完整的信息如下:

Cloning into 'xyzabc'...
remote: Counting objects: 4328, done.
remote: Compressing objects: 100% (3861/3861), done.
select: Not enough memory2192/4328), 123.71 MiB | 164.00 KiB/s
ffatal: The remote end hung up unexpectedly
atal: early EOF
fatal: index-pack failed

我在网上搜索解决方案,尝试了其他的每一个解决方案后,最终采取了以下解决方案:

git clone --depth=1 path

接着

git fetch --unshallow

现在克隆已经完全完成。但是,当我尝试运行git fetch --unshallow以接收完整的项目时,我会收到以下错误:

fatal: --unshallow on a complete repository does not make sense

我不知道该怎么做,请指导。

6个回答

12

我也发现了同样的消息。看起来它不允许取消 shallow clone。你可能想要尝试一下。

git fetch --depth=10000

假设你的克隆体中有10000个深度。


11

git fetch --depth=10000 仍然是必要的,但你现在有了一种方法通过 Git 2.14.x/2.15, Q4 2017 来确认你的 repo 是否为 unshallow。

参见 commit 417abfd (2017 年 9 月 18 日) by Øystein Walle (``)
(由 Junio C Hamano -- gitster --commit 3430fff 中合并,2017 年 9 月 25 日)

rev-parse: rev-parse: 添加--is-shallow-repository选项

"git rev-parse" 学会了 "--is-shallow-repository",这个选项类似于已有的 "--is-bare-repository" 和其他选项。

在非浅层仓库上运行 git fetch --unshallow 会产生致命错误信息。
添加一个辅助工具到 rev-parse 中,供脚本编写者用来确定一个仓库是否是浅层仓库。


3
请参考 https://dev59.com/aloU5IYBdhLWcg3wYWIM 以了解用法。 - Tim Abell

8

对于Azure DevOps构建管道,您需要进入构建管道 => 编辑 => 触发器 => YAML => 获取源代码

enter image description here

保存并重新运行构建管道


2
兄弟,我不知道你为什么决定回答这个非常特定的用例,但这正是我在寻找的。非常感谢!我想亲吻你! - Adrian Pauly
1
你正在参加AZ-400考试吗?这篇文章确实及时。谢谢。 - Ryu S.
2
这救了我的一天!!!! - Hoang Minh

0

你这里漏掉了一步操作,

在此之后,

git clone --depth=1 path

进行这个操作后,进入您的项目目录。

cd <intoPartiallyClonedProject>

然后,您需要执行 git fetch --depth=N 命令,其中 N 逐步增加,例如

git fetch --depth=5
git fetch --depth=200
git fetch --depth=500
git fetch --depth=1000

然后执行

这个最好在这个答案中详细解释,

answer 由我即NikhilP提供

error: RPC failed; curl transfer closed with outstanding read data remaining

如果有帮助,请点赞。


1
这在相同情况下给我相同的错误信息,就像 --unshallow 一样。 - Pavel Šimerda

0
在GitLab中,有一些配置可以帮助解决错误:
对于每个项目: 1. 在顶部菜单栏中,选择“主菜单”>“项目”,找到您的项目。 2. 在左侧边栏中,选择“设置”>“CI/CD”。展开“常规流水线”。 3. 在Git策略下,选择git fetch,在Git浅克隆下,输入一个值,1000,这是GIT_DEPTH的最大值。了解更多信息-https://gitlab.yourcompany.com/help/ci/pipelines/settings#limit-the-number-of-changes-fetched-during-clone{}
在.gitlab-ci-yml文件中(在调用GitVersion.exe之前),需要进行以下操作。
  before_script:
    - git fetch --prune --tags --unshallow  

-4

这个消息意味着您已经取消了对存储库的隐藏。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接