I would like to expose a Git / Gitlab problem preventing me from initializing a remote with gitlab-ee-14.2.4. This is my goal:
- I need to work on a small part of a very large project with a very long history (several GB) and I want to downsize it but keeping tho possibility to push or pull some commits with may be cherry-pick.
- I create a branch, remove all the needless parts, commit and push this branch on the remote
- Then I clone this branch in a new folder, truncating the history with:
git clone -b mybranch --single-branch --depth=1 git@my-global-remote:myrepo myNewrepo
- As I have no master (called main with new version of gitlab) I create a main branch:
git checkout -b main
- That’s fine, I’ve only some hundreds of MB with a common commit in the main branch. So I create a new empty repo on my local gitlab instance and I add this local gitlab remote to push :
git remote add mostgit email@example.com:begou/my-test.git
as suggested in the web interface after creating an empty repo.
But I cannot push my repo to my local gitlab instance:
git push mostgit main Counting objects: 4768, done. Delta compression using up to 8 threads. Compressing objects: 100% (2764/2764), done. Writing objects: 100% (4768/4768), 372.45 MiB | 10.58 MiB/s, done. Total 4768 (delta 1889), reused 4768 (delta 1889) remote: Resolving deltas: 100% (1889/1889), done. remote: fatal: did not receive expected object b8a07923a333c969deb3480a6c356300c5c195c9 error: unpack failed: index-pack abnormal exit To firstname.lastname@example.org:begou/my-test.git ! [remote rejected] main -> main (unpacker error) error: failed to push some refs to 'email@example.com:begou/my-test.git'
I’m sure I’m wrong somewhere but… where ?