1

我想在 jenkinsfile 中运行这个命令

git checkout <repo> <folder name>

但我得到这个错误

[git-checkout-example] Running shell script
+ git checkout git@code.in.spdigital.io:sp-digital/jarvis-api.git wahahah
fatal: Not a git repository (or any of the parent directories): .git

知道如何在 Jenkinsfile 中进行操作吗?我可以将文件签出到特定文件夹吗?

4

1 回答 1

0

我可以将文件签出到特定文件夹吗?

您可以签特定文件夹的文件,而不是 * 到特定文件夹。

git checkout手册页

<paths>给出时,git checkout不切换分支。
它从索引文件或命名<tree-ish>(通常是提交)更新工作树中的命名路径。

git checkoutwith<paths>用于从索引中将修改或删除的路径恢复到其原始内容,或者将路径替换为命名<tree-ish>(通常是 commit-ish)中的内容。

但是在您的情况下,问题来自您执行时的当前工作目录git checkout xxx -- path:您需要位于 git repo 中。

尝试将 repo 签出路径被称为git clone,而不是git checkout

于 2016-12-13T05:38:12.813 回答