Running the SAST analyzer fails: git: 'lfs' is not a git command

We are running a self-managed Gitlab Enterprise instance with gitlab-runner 13.8.0.
The repo I’m scanning makes use of sub-modules and git lfs references.
When trying to prepare the git repo for the scan, the git lfs command fails like so:

Entering 'some_repo/1'
Entering 'some_repo/2'
$ git submodule update --init --recursive;
$ git submodule foreach --recursive git lfs pull;
Entering 'some_repo/1'
git: 'lfs' is not a git command. See 'git --help'.
The most similar command is
fatal: run_command returned non-zero status for some_repo/1

I guess git lfs is not installed on the SAST analyzer images. Is there a way around this issue?

@bt-nia I can think of creating your own image from the official one. You could also raise Issue for the team to add it to official images.

EDIT: or try to install it in before_script

1 Like