如何仅 git 使用 Jenkins 从存储库中提取特定文件夹?

How to only git pull in particular folder from a repository using Jenkins?

我在 D:/TestFolder/ 中有一个文件夹现在我需要在每次触发作业时使用 Jenkins git 拉入 TestFolder。怎么可能?

任何人都可以指导我使用 Jenkins git 拉入特定文件夹吗?

git Jenkins 的插件带有该选项 -

如果您使用的是 Jenkins freestyle 作业,

如果你使用的是 Jenkins 脚本化管道,它会像

node() {
  stage('checkout') {
     checkout([$class: 'GitSCM', branches: [[name: '*/master']], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: 'sub_folder']], submoduleCfg: [], userRemoteConfigs: [[credentialsId: 'credentialId', url: 'http://repourl.net/x.git']]])

  }
}