简体   繁体   English

如何使用管道脚本仅将特定文件夹从 git 克隆到 Jenkins 工作区?

[英]How to clone only a specific folder from git to Jenkins workspace using pipeline script?

I want to clone only a specific folder from git repo to Jenkins workspace using pipeline script?我只想使用管道脚本将 git 存储库中的特定文件夹克隆到 Jenkins 工作区? Is it possible?可能吗?

 stage('SCM Scripts Checkout') {
            steps {
              git branch: 'live-state-container'
              url: 'ex777@git.exe.com:managed/12323/232345.git'
            }

I think you are confusing the term "checkout" with "clone."我认为您将“结帐”一词与“克隆”混淆了。 Jenkins clones whole repositories instead of having them persist on the file system and pulling changes in when needed. Jenkins 克隆整个存储库,而不是让它们保留在文件系统上并在需要时拉入更改。

You cannot clone part of a Git repository.您不能克隆Git 存储库的一部分。 You can clone a bare repository with the git clone --bare command or choose not to checkout HEAD with git clone --no-checkout , which are both interesting options.您可以使用git clone --bare命令克隆一个裸存储库,或者使用git clone --no-checkout选择不签出HEAD ,这两个选项都很有趣。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM