在Windows gitlab ci中无法识别Git

时间:2018-03-07 15:18:59

标签: git gitlab-ci

我按照此处的说明配置了一个gitlab运行器:https://docs.gitlab.com/runner/install/windows.html

不幸的是,当我推送到我的存储库时,我的管道失败了:

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

当我以管理员身份打开命令行实用程序时,git可用。

知道为什么git在管道脚本中无法识别?

5 个答案:

答案 0 :(得分:2)

我自己解决了这个问题:我的.gitlab-ci.yml脚本正在重新定义PATH环境变量。

答案 1 :(得分:1)

对我而言,发生在启动PowerShell以运行gitlab-runner之后安装了git的情况。要解决此问题,您需要在安装git之后重新启动PowerShell,然后重新启动gitlab-runner以使git进入您的PATH。

答案 2 :(得分:1)

如果你在 gitlab-runner 之后安装了 git,你必须重新启动 gitlab-runner 服务。

答案 3 :(得分:0)

在C:\ Git而不是c:\ Program Files上安装Git ...为我解决了此问题。

答案 4 :(得分:0)

我的运行程序安装在Amazon EC2实例上,并且在安装运行程序之后安装了git。我发现重新启动整个EC2实例后将其修复。重新启动服务还不够。