I'm posting this question because googling gitlab bad object refs/pipelines/ found no similiar pages, and I think it is interesting to investigate.
There's no stable and minimal reproducible steps, just describe what happend. I have(the owner) a repo and with only single branch main
, add has .gitlab-ci.yml
to enable pipelines. Never added any pre or post hooks. Mainly use git for windows built in bash or git gui to pull and push. Everything goes smoothly until one day push got error like
Pushing to git.labs.hosting.of.mycompany:myrepo.git
remote: fatal: bad object refs/pipelines/2651688
fatal: bad object refs/pipelines/2651688
To git.labs.hosting.of.mycompany:myrepo.git
![remote rejected] main -> main (missing necessary objects)
error: failed to push some refs to 'git.labs.hosting.of.mycompany:myrepo.git'
The number 2651688
is the one of the most recent(not last one, and successful) pipelines of this repo. To my limited git knowledge, refs should mean something like branch, but I never create branch name like that. So I thought the repo state corrupted when running ci.
Tried cloning the repo to another folder and push directly, same issue. so seems not client side issue. Also tried push another repo in same group, no problem.
There's no special jobs changing the repo itself. By running git ls-remote
for this problematic repo got many refs/keep-around/*
, still don't see refs/pipelines/*
3ef2b1aba9f1493a039c18c978ae192143363ee6 HEAD
3ef2b1aba9f1493a039c18c978ae192143363ee6 refs/heads/main
064e56e78a6679ec570ad506e0b2f861dbada059 refs/keep-around/064e56e78a6679ec570ad506e0b2f861dbada059
...tens of refs/keep-around/*
Could anyone explain why this issue happens and could it be solved from client side? I'm not the gitlab owner so cannot do anything on server side repo directly. After a random housekeeping, i can push now. so i cannot reproduce the issue.
CodePudding user response:
When you run git push
, the lines pefixed with a remote:
indicate they are executed on the server side, as part of a pre-receive
hook for example. I'm not familiar enough with the standard actions run through a .gitlab-ci.yml
, but I would say your first push happened at a moment when the remote repo wasn't in sync with some other gitlab data.
is this error persistent ? or does it go away with time ?
does it go away if you manually launch a new gitlab CI job, then run a
git push
?
(these two questions would point to some issue with how the repo used by gitlab's jobs is synced with gitlab's data)
- on your local clone: if you run
git ls-remote
, do you see references namedrefs/pipelines/...
?
do check the documentation for the actions you trigger from your .gitlab.yml
.