简体   繁体   中英

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 .

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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