将多个存储库浅浅地提取到一个工作空间会导致错误

时间:2015-05-13 12:34:35

标签: git

为什么将带有--depth=1(浅层克隆)的2个git存储库放入一个工作空间会出错:

fatal: did not find object for shallow 6885f7a1d032df25195fb56a7c1a64049a19cd62

这些是完成的语句(从jenkins输出复制,但手动提取结果出现相同的错误),省略了添加遥控器:

git init c:\workspace
git -c core.askpass=true fetch --tags --progress ssh://developer@***/bar +refs/heads/*:refs/remotes/bar/* --depth=1
git -c core.askpass=true fetch --tags --progress ssh://developer@***/foo +refs/heads/*:refs/remotes/foo/* --depth=1

在没有--depth选项的情况下获取2个存储库工作正常。

我注意到,在第一次获取文本文件后,“浅”#39;是在.git文件夹中创建的,带有一堆提交ID,错误中的一个是其中之一。我认为通常在从同一个存储库中再次获取时,Git使用这些提交来告诉远程它知道什么引用,但在这种情况下,它将一个repo的commitid发送到另一个repo,从而失败。

我怎样才能让它发挥作用?

1 个答案:

答案 0 :(得分:0)

在审核了您的其他信息后,我建议您在回购邮件中添加2个来源,然后再获取。

git remote add bar ...
git remote add bar ...

git fetch bar ... --depth=1
git fetch foo ... --depth=1