簡體   English   中英

GitLab CI構建失敗,git無法識別

[英]GitLab CI build fails with git is not recognized

我已經設置了一個GitLab管道,並配置了一個跑步者。 構建在我提交時開始,但幾乎立即失敗,並顯示以下消息:

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

這是我的.gitlab-ci.yml,我已經剝離了它以試圖找出問題:

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

我能找到的唯一類似問題就在這里這里

當我在標准命令提示符中嘗試使用git時因為我的PATH未在環境變量中正確設置而我在獲取相同的消息時,我認為我已經修復了該問題。

但是我現在已經修復了這個問題,並且我通過命令提示符從git獲得了預期的響應,但是當gitlab啟動構建時我仍然會遇到問題。

有任何想法嗎?

在buildmachine上安裝新應用程序后重新啟動gitlab runner以獲取路徑。

將Git安裝到c:\\Git而不是c:\\Program Files...為我解決了這個問題

我使用gitlab-ci和powershell作為執行者。
添加git路徑C:\\Program Files\\Git\\bin$PATH修復了這個問題

你在CI上安裝了git嗎? 在我的.gitlab-ci.yml解決了這個問題,通過添加apk update && apk add gitbefore_script ,如下所示:

# 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.

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM