Short story
How to tell gitlab-runner to use this specific git installation, e.g. at /opt/gitlab/embedded/bin/git?
Context
I am using a gitlab-runner with shell executor to build docker images.
However the pipeline already fails at the beginning with
fatal: git fetch-pack: expected shallow list fatal: The remote end hung up unexpectedly
This is clearly related to this question. There are also good solution metioned in this answer.
One of them is to install a newer version of git.
The current git --version gives git version 1.8.3.1 which is the system default.
On the same machine I have GitLab running which comes with a newer version of git.
Via gitlab-rake gitlab:env:info I find that a newer git (/opt/gitlab/embedded/bin/git) is already installed, /opt/gitlab/embedded/bin/git --version gives git version 2.32.0.
Attempts
I already tried adding
environment = ["PATH=/opt/gitlab/embedded/bin:$PATH"]
to the specific [[runner]] in my /etc/gitlab-runner/config.toml but this seems to overwrite PATH completely (the pipeline fails with some mkdir not found error).
$at:PATH. Here, you totally wreck the path variable with a constant 'PATH' string.:$PATH.