我想在我的Windows 10机器上安装gitlab-runner
(执行者shaell
)。我在gitlab服务器上开始工作,它总是以the command "git" cannot be found
消息结束(大致翻译成英文)。
事实上git
不是我道路的一部分。
如何修改PATH
启动的shell的gitlab-runner
变量?
要在Windows命令行中使用git,我通常使用语句PATH %PATH%C:\Program Files\Git\bin
设置它。
是否在某处记录,git
必须为跑步者提供?
如何查看转轮调用的命令行(即调用git)?
答案 0 :(得分:4)
出于测试目的,我从gitlab-runner
和gitlab-runner -l debug --debug run --config config.toml --service gitlab-runner
文件所在的目录中启动了gitlab-runner.exe
,如:config.toml
。
我将以下行添加到runners
文件的config.toml
部分:
environment = ['PATH=%PATH%;d:/java/bin;C:/Program Files/Git/bin;c:/program files (x86)/apache-ant-1.10.1/bin']
答案 1 :(得分:0)
此GitLab Runner issue回答了您的问题。
environment
设置不起作用,因为它会在设置变量之前进行评估,但是您可以在运行程序配置中使用pre_build_script
来更新路径。
[[runners]]
name = "My Runner"
url = "https://gitlab.com/"
token = "Abcd1234"
executor = "shell"
pre_build_script = "set Path=%GIT_HOME%\\usr\\bin;%Path%"
答案 2 :(得分:0)
在macOS上,对我真正有用的唯一操作是this solution,将PATH添加到Library/LaunchAgents/gitlab-runner.plist
:
<key>EnvironmentVariables</key>
<dict>
<key>PATH</key>
<string>/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
</dict>
然后重新启动gitlab-runner,您一切顺利。
我想也有Windows等效的解决方案。