简体   繁体   English

git push * to *浅表克隆,为什么不呢?

[英]git push *to* a shallow clone, why not?

So everybody seems to be asking why one cannot push from a shallow clone (while I actually already achieved this). 因此,每个人似乎都在问为什么不能一个浅表克隆中进行推送(尽管我实际上已经做到了这一点)。 However what I'm interested in is pushing to a shallow server. 但我感兴趣的是推浅服务器。

This doesn't work (I've served the git repo via "git clone --bare --depth 1 the_original_repo" in my server, and I cannot clone from it because it says it is a shallow clone). 这是行不通的(我已经通过服务器中的“ git clone --bare --depth 1 the_original_repo”提供了git repo,由于它说它是一个浅表克隆,所以我无法从中克隆出来)。 But I'm thinking that if one tries to clone with the same depth as the shallow clone was created, why would we have the limitation? 但是我在想,如果尝试克隆的深度与创建浅克隆的深度相同,那为什么会有限制呢?

My end-goal would be something like this setup: 我的最终目标将是这样的设置:

          (shallow-SERVER)
           /            \
(full-history-client)  (shallow-client)

This way, both shallow nodes would have no history at all, but there would be a client which has the full history. 这样,两个浅节点将完全没有历史记录,但是会有一个具有完整历史记录的客户端。 If the shallow-client pushed to the shallow-server, it would mean that their depth increases, but ideally it would decrease again when the full-history-client pulls from the server. 如果浅层客户端推送到浅层服务器,则意味着它们的深度会增加,但是理想情况下,当完整历史客户端从服务器中拉出时,深度会再次减小。

I guess this is not doable with git nowadays, right? 我想现在这对git来说是行不通的,对吧?

There's no reason you can't push from or fetch into a partial repository so long as you've got enough to generate the necessary pack, I've done both too. 只要您有足够的能力来生成必要的包,就没有理由不能从中推送或获取到部分存储库,我也已经做到了。

But you can't set a partial repository up to serve other people. 但是您不能设置部分存储库来服务其他人。

Truly partial repos are very special-purpose, for most uses you want the path to a(t least one) local shared objects directory containing a full history in .git/objects/info/alternates instead. 真正的部分存储库是非常特殊的用途,对于大多数用途,您想要到(至少一个)本地共享objects目录的路径,而该目录包含.git/objects/info/alternates中的完整历史记录。 It's not necessary for those to even be in a repo at all. 那些人根本没有必要进行回购。 I wouldn't call that a kludge, it makes accidental gc flat-out impossible, but there may be other schools of thought on that. 我不会这么称呼它,这使意外的gc彻底消除是不可能的,但是对此可能还有其他的想法。

Any place that can't afford even one full pack has no business serving as any kind of shared repo, 在一个连一整包都买不起的地方,没有任何业务可以作为任何类型的共享仓库,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM