GitLab CI/CD无法访问其他仓库LFS对象的问题排查
GitLab CI/CD拉取公开仓库Git LFS对象失败排查
问题详情
CI/CD执行时触发错误:
batch response: Repository or object not found: https://gitlab-ci-token:[MASKED]@gitlab.com/davidvandebunte/public.git/info/lfs/objects/batchCheck that it exists and that you have proper access to it
目标仓库为公开仓库,且LFS对象已正常上传,理论上无权限问题。已查阅GitLab官方排障文档(内容过时,git lfs -l命令不存在)及论坛同类帖子,未找到有效解决方案。当前Git LFS版本:
git-lfs/3.7.1 (GitHub; linux amd64; go 1.24.4)
可能遗漏的排查点
- CI环境LFS认证冲突:公开仓库无需认证,但CI默认使用
gitlab-ci-token可能触发权限限制。可在CI脚本中强制匿名拉取:# 覆盖仓库LFS认证配置 git config lfs.http://gitlab.com/davidvandebunte/public.git/info/lfs.access none # 重新拉取LFS对象 git lfs pull - 子模块LFS同步问题:若目标仓库是子模块,需确保子模块克隆时同步LFS:
git submodule update --init --recursive git lfs pull --recursive - LFS对象有效性验证:本地重新推送并验证LFS对象完整性:
git lfs push --all origin git lfs ls-files --checkout - Runner环境LFS配置:确认CI Runner已正确安装Git LFS,可在CI脚本中添加初始化步骤:
git lfs install --force git lfs version
内容的提问来源于stack exchange,提问作者davidvandebunte




