从Jenkins安装和更新Pod时出错

sh7euo9m  于 2023-04-29  发布在  Jenkins
关注(0)|答案(1)|浏览(196)

bounty明天到期。回答此问题可获得+50声望奖励。DropAndTrap正在寻找一个答案从一个有信誉的来源

[iOSTestBuild] $ /bin/sh -xe /var/folders/7h/c_dd36k5627bbs6pbhd4zglw0000gn/T/jenkins10828028391649479003.sh
+ /opt/homebrew/bin/pod install --repo update
    [33mWARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
    Consider adding the following to ~/.profile:

    export LANG=en_US.UTF-8
    [0m
/opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/executable.rb:118:in `block in which!': [31m[!] Unable to locate the executable `git`[0m (Pod::Informative)
    from <internal:kernel>:90:in `tap'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/executable.rb:117:in `which!'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/executable.rb:143:in `capture_command'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:126:in `git_version'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:140:in `verify_minimum_git_version!'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/lib/cocoapods/command.rb:49:in `run'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/gems/cocoapods-1.12.0/bin/pod:55:in `<top (required)>'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/bin/pod:25:in `load'
    from /opt/homebrew/Cellar/cocoapods/1.12.0/libexec/bin/pod:25:in `<main>'
Build step 'Execute shell' marked build as failure
Finished: FAILURE

在我的Mac上,当我运行相同的命令时,它可以工作,只有通过Jenkins,当我运行命令时,它给我这个错误。

doinxwow

doinxwow1#

如果它通过Jenkins工作,而不是在shell上工作,这意味着环境/用户是不同的。
在Jenkins上,添加到你的作业命令中,查看你的用户和环境是什么,以及它在哪里找到git

id -a
env
which git

这样,您将看到需要添加到用户环境中的内容,以便在$PATH中获得Git,就像Jenkins代理(假设它在Mac上运行)所能做的那样。

相关问题