.gitlab-ci.yml "git: not found"

Hi! I’m new to the forum; I didn’t find this problem reported here or in Stackoverflow. I have an account in gitlab.com where I’m finding a problem with the continous integration.

Here is my simple and simplified .gitlab-ci.yml:

image: docker
services:
- docker:dind

before_script:
  - apt-get update -qq && apt-get install -y -qq git 
  - git --version

test-library:
  stage: test
  script:
  - echo "hello, world"
  only:
    - master

What I was expecting was to see in the pipeline console:

  • the version of git
  • and “hello, world”

The current result is:

$ apt-get update -qq && apt-get install -y -qq git
$ git --version
/bin/sh: eval: line 49: git: not found
ERROR: Job failed: exit code 127

As far as I know, there isn’t a problem with the runners version (I’m using gitlab.com). From this reference (https://docs.gitlab.com/ee/ci/yaml/#git-strategy) with other examples of git commands, I’m assuming that this is something possible. Could you give any hint to find this out?

Thanks for your time!

SOLVED

Ok, finally found it.

  • first of all, “apt-get” doesn’t exist; as it’s an alpine docker, the correct line is:
- apk update && apk add git
  • secondly, the error was shown above the execution of the line, and I just didn’t see it. Thanks to a colleague looking at the code, we finally saw the error messages.

:grin:

4 Likes