Pushing from CI pipeline back to repository fails if using large file storage (LFS)
We are using the GitLab CE docker image version 18.2.2-ce.0 . We want CI job to push commits back to the projects repository using the new feature (#389060 (closed)) introduced in Version 17.2. Everythings works fine with "regular" repositories. However, when I enable LFS, git push fails with "Authentication error: Authentication required: Access forbidden. Check your access level.".
To reproduce this issue:
- Create new project on GitLab.
- Enable "Allow Git push requests to the repository" in the project's CI settings.
- Push attached files (.gitattributes and .gitlab-ci.yml) to GitLab with the inital commit.
- Start the pipeline manualy. Manual start is required to avoid infinite loops!
The CI pipeline creates/modifies a blob.bin file, creates a commit for it and pushes it back to the repo. LFS is enabled (.gitattributes file and git lfs install instruction in before_script). In my environment, the push fails with Access forbidden.
Disable LFS by deleting .gitattributes file and removing the git lfs install directive from before_script. Push the changes to the repo and restart the pipeline. It should now succeeded.
Using a project access token to push to the repository works even with LFS enabled. I expected the same behavior when using the CI job token.