简体   繁体   English

在浅克隆之后,Git推送到新的遥控器

[英]Git push to a new remote after shallow clone

Is it possible to do this? 是否有可能做到这一点? I have a few branches and quite a few commits, and I am trying to 我有一些分支和很多提交,我正在尝试
git push - --all origin but I am getting shallow update not allowed . git push - --all origin但我shallow update not allowed

Thanks in advance. 提前致谢。

No, that is not possible. 不,那是不可能的。

Having a shadow clone means that they oldest commits in your repository are "inverse dangling", ie they point to parent commits that you do not have. 拥有影子克隆意味着它们在您的存储库中最早的提交是“反向悬挂”,即它们指向您没有的父提交。 This makes your data structure invalid since git normally enforces a complete history - it glosses over the problem as you instructed it to make a shallow clone, but still. 这使得您的数据结构无效,因为git通常会强制执行完整的历史记录 - 它会在您指示它进行浅层克隆时掩盖问题,但仍然如此。

You can only push to remotes that already have the commits you are missing. 您只能推送已经缺少提交的遥控器。

So, your solution is to unshallow your clone and then push to your new repository. 因此,您的解决方案是解压缩克隆,然后推送到新的存储库。 Alternatively, if you want to avoid having all that history in your repos, you can create the new repository from your own upstream (which hopefully is not shallow) without touching your own repository and then push into it. 或者,如果您想避免在您的存储库中拥有所有历史记录,您可以从您自己的上游(希望不浅)创建新存储库,而无需触及您自己的存储库然后推入它。

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

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