5

I have set up a GitLab pipeline, and configured a runner. The build starts when I make a commit, but fails almost immediately with the following message:

C:\GitLabRunner\builds\xxxxxxxx\0\cmac\portal>"git" "checkout" "-f" "-q" 
   "xxxxxxxxxxxxxxxxxxxxxxxxx" 

 '"git"' is not recognized as an internal or external command,
   operable program or batch file.

C:\GitLabRunner>IF 9009 NEQ 0 exit /b 9009 
ERROR: Job failed: exit status 9009

This is my .gitlab-ci.yml, which I have stripped right back to try and isolate the issue:

stages:
 - build
variables:
  CI_DEBUG_TRACE: "true"
Build:
  stage: build
  script:
     - Echo OK

The only similar issues I could find are here and here

I thought I had fixed the issue when I was getting the same message in a when trying to use git in a standard command prompt as my PATH wasn't set correctly in Environment variables.

However I have now fixed this and I am getting expected responses back from git through the command prompt, however I still get the issue when gitlab kicks off the build.

Any ideas?

Declan McNulty
  • 2,985
  • 6
  • 32
  • 50

4 Answers4

1

After you install new applications on your buildmachine restart gitlab runner to pick up path.

GintsGints
  • 738
  • 6
  • 14
  • More generally, when you modify the environment variables you have to restart the gitlab runner to update its environment. – fkorsa May 03 '18 at 08:16
0

Installing Git to c:\Git instead of c:\Program Files... fixed this problem for me

ovsvolvic
  • 3
  • 1
0

I use gitlab-ci with powershell as executor.
Add the git path C:\Program Files\Git\bin to $PATH fixed this problem

Tiw
  • 5,078
  • 13
  • 24
  • 33
ljian
  • 21
  • 2
0

Did you install git on the CI? In my .gitlab-ci.yml solved this by adding apk update && apk add git to the before_script, like so:

# Make sure to install all packages before running anything.
before_script:
  - apk update && apk add git
  - npm ci # For CI it's better to have this instead of npm install.
Daniel Danielecki
  • 5,838
  • 4
  • 44
  • 72