Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git is not recognized in Windows gitlab ci

Tags:

git

gitlab-ci

I configured a gitlab runner as explained here: https://docs.gitlab.com/runner/install/windows.html

Unfortunately, when I push to my repository, my pipeline fails:

Running with gitlab-runner 10.5.0 (80b03db9)
  on windows runner 79cb4019
Using Shell executor...
Running on WINSTD-45-13...
'"git"' is not recognized as an internal or external command,
operable program or batch file.
'"git"' is not recognized as an internal or external command,
operable program or batch file.
Cloning repository...
'"git"' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
Checking out b05fd8be as master...
'"git"' is not recognized as an internal or external command,
operable program or batch file.
ERROR: Job failed: exit status 9009

When I open the command line utility as administrator, git is available.

Any idea why git is not recognized whithin the pipeline script?

like image 938
Martin Delille Avatar asked Mar 07 '18 15:03

Martin Delille


4 Answers

For me it happened that I installed git after I started PowerShell to run gitlab-runner. To fix this you need to restart PowerShell after git is installed and then restart gitlab-runner to get git on your PATH.

like image 115
RamiR Avatar answered Nov 13 '22 01:11

RamiR


If you installed git after gitlab-runner you have to restart gitlab-runner service.

like image 38
Yunus Eş Avatar answered Nov 13 '22 02:11

Yunus Eş


I solved the problem myself: my .gitlab-ci.yml script was redefining the PATH environment variable.

like image 5
Martin Delille Avatar answered Nov 13 '22 01:11

Martin Delille


My runner was installed on an Amazon EC2 instance, and I installed git after I installed the runner. I found restarting the entire EC2 instance fixed it. Restarting the service was not enough.

like image 1
Cobertos Avatar answered Nov 13 '22 02:11

Cobertos