Home > OS >  gitlab-runner cant find git
gitlab-runner cant find git

Time:11-02

I am getting the following error when try to configure my gitlab CI, git is installed in my system and i can run git from cmd. This setup is to run gitlab runner on my local machine. Here is my gitlab-ci.yml

stages:
  - build
  - test

before_script:
  - echo "before_script"
  - export PATH=$PATH:C:\Users\something\AppData\Local\Atlassian\SourceTree\git_local\bin

build-job:
  tags: 
    - ci
  stage: build
  script:
    - echo "Hello, $GITLAB_USER_LOGIN!"


test-job2:
  tags: 
    - ci

  stage: test
  script:
    - echo "This job tests something, but takes more time than test-job1."
    - echo "which simulates a test that runs 20 seconds longer than test-job1"
    - start matlab   -nosplash -nodesktop -minimize  -r  "run('C:\repos\ci-sandbox\unitTest\rightTriTestRunner.m');quit" -logfile C:\repos\ci-sandbox\unitTest\output.log

here is error that i get in my pipline.

Running with gitlab-runner 14.4.0 (-)
      on runner1 ------
    Resolving secrets
    00:00
    Preparing the "shell" executor
    00:00
    Using Shell executor...
    Preparing environment
    00:01
    Running on ---...
    DEPRECATION: CMD shell is deprecated and will no longer be supported
    Getting source from Git repository

    Fetching changes with git depth set to 50...
    '"git"' is not recognized as an internal or external command,
    operable program or batch file.
    Cleaning up project directory and file based variables
    
    ERROR: Job failed: exit status 9009

CodePudding user response:

This is similar to issue 2743:

I had similar issues recently on a new Windows Server 2016 Core install. In my case, I simply had to make certain I defined git as well as git home as global variables.

PS C:\Users\Administrator\Documents> Get-ChildItem Env:

Name                           Value
----                           -----
...
GIT                            C:\Users\Administrator\scoop\apps\git\current\cmd\git.exe
GIT_INSTALL_ROOT               C:\ProgramData\scoop\apps\git\current

I found the problem: my .gitlab-ci.yml script was redefining the PATH environment variable so it override the one from the system.

In your case, try and do not redefine the PATH, to see if it works better.

CodePudding user response:

I have exactly a similar issue and tried what was suggested in issue but nothing has worked yet.

  • Related