首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >gitlab-runner找不到git

gitlab-runner找不到git
EN

Stack Overflow用户
提问于 2021-10-29 21:08:07
回答 2查看 211关注 0票数 2

当我尝试配置我的gitlab配置项时,我得到了以下错误,git安装在我的系统中,并且我可以从cmd运行git。这个设置是在我的本地机器上运行gitlab runner。这是我的gitlab-ci.yml

代码语言:javascript
复制
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

这是我在我的管道中得到的错误。

代码语言:javascript
复制
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
EN

回答 2

Stack Overflow用户

发布于 2021-10-30 00:29:25

这类似于issue 2743

最近,我在新的Windows Server 2016核心安装中遇到了类似的问题。在我的例子中,我只需确保将git和git home定义为全局变量。

代码语言:javascript
复制
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

我发现了问题:我的.gitlab-ci.yml脚本重新定义了PATH环境变量,因此它覆盖了系统中的环境变量。

在您的情况下,尽量不要重新定义PATH,看看它是否工作得更好。

票数 0
EN

Stack Overflow用户

发布于 2021-11-01 03:46:18

我有一个完全类似的问题,并尝试了issue中建议的方法,但都没有起作用。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69774789

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档